vendredi 7 septembre 2018

Get checkbox value using onchange function

I am multiple using multiple checkbox checkbox for some action but if i checked and unchecked the checkbox i am able to get only the value as 'on' my requirement is that to get on if the checkbox is checked and off when checkbox is unchecked.

<label class="cont">
   <input type="checkbox" name="listingstatus" id="listingstatus<?php echo $doc->module_video_id; ?>" onchange="listingStatus('<?php echo $doc->module_video_id; ?>')">
   <span class="checkmark"></span>
</label>


function listingStatus(module_video_id)
{
  var a = $('#listingstatus'+module_video_id).val();
  console.log(a);
}




Aucun commentaire:

Enregistrer un commentaire