jeudi 20 avril 2017

refresh a checkbox after changing with jquery

I have two checkboxes, one with a label, one without:

<label for="ch1">Box 1</label>
<input type="checkbox" id="ch1" name="check1"/>          
<input type="checkbox" id="ch3" name="check2"/>
<button id="b">click here</button>

And the script is:

$('#b').click(function() {
    $('#ch1').prop('checked', true);       
    $('#ch3').prop('checked', true);
})

After a click on the button, both checkboxes seem to be checked, but only the second one shows the "tick". How can I refresh the labeled checkbox?

These are the jquery-files:

    jquery.mobile-1.4.5.min.css
    jquery-2.2.4.min.js
    jquery.mobile-1.4.5.min.js




Aucun commentaire:

Enregistrer un commentaire