dimanche 26 novembre 2017

.change() in jquery not working?

I have three check boxes I want to make mutually exclusive. I have written the following code:

window.jQuery && jQuery(window.parent.document).ready(function() {
$('#id1,#id2,#id3').live('change', function(){
if ($this.prop('checked', true))
$('#id1,#id2,#id3').not(this).prop('checked', false)
})});

I have placed this code at the very bottom of the page. I have checked the solutions offered in: HTML <select> JQuery .change not working

I receive no error messages in console before or after pressing the check boxes, it just doesn't seem to work.

Do I need to create a separate function and attach it to an "onchange" event for the check boxes in the HTML code?




Aucun commentaire:

Enregistrer un commentaire