Clicking the jQuery Mobile Button?

I used the code below on the checkbox. It works on the local host, but it did not work on mobile devices when I unchecked the box. Does anyone have a solution for this?

$("#checkbox-1a").change (function(){ var chkstatus = $(this).attr('checked'); alert(chkstatus); if (chkstatus != 'checked') { $('#locationdiv').slideUp(); $('#address').val(''); $('#zip').val(''); } else { $('#locationdiv').slideDown(); } }); 

Thank you in advance

+4
source share
2 answers

Since jQuery mobile uses all this fancy markup, you need to call the special jQuery function to update the checkbox.

 $("#id").prop("checked", true/false).checkboxradio('refresh'); 

It works well. I think there are other ways to set the property, but be sure to enable the update, otherwise jQm will not update the markup.

+5
source

Have you tried : checked selector?

0
source

All Articles