mardi 3 mars 2015

Jquery Set a checkBox based on another checkbox selected

i have two check boxes once i check the first one , the 2nd check box should be selected simple and easy ! but i can't see to figure out what's wrong and why the 2nd checkbox is not being checked in the html editor one more thing my check boxes has the export value of 1 so when checked should be 1



var opt_identity = $('#chkOpt_contractType').val();
var ShortSale = $('#chkOptShortSale').val();

if (opt_identity == 1)
{
// I tried both of these lines but still i dont see the check box being check
$('input[name="chkOptShortSale"][value='1']').prop('checked', true);
$('#chkOptShortSale').prop('checked', true);
} else {
$('.checked').removeAttr('checked');
alert('HH Else = ' + ShortSale);




Aucun commentaire:

Enregistrer un commentaire