jeudi 21 avril 2016

Get value of a check box in JavaScript?

I am a newbie to jquery. I have this code written. I want to get the value of 'newValue' when the checkbox is checked. But this code returns 'undefined'.

Please can someone help to get the state of the checkbox: the return value should be true or false, 1 or 0.

$(tableCell).empty();
/Checkbox
 $('<input type="checkbox" checked class="EditContactRow" style="width: 20%" />').appendTo($(tableCell)).val(controlValue).blur(function () {
  var newValue = $(tableCell).find('checkbox').val();
.....
.....
}

Thanks




Aucun commentaire:

Enregistrer un commentaire