Thursday, 19 September 2013 11:11

Handling checkbox in JQuery Mobile

In JQM (or just JQuery really) don't forget the
prop()
method for properties as opposed to attributes
attr()

This is a check box solution when one or both but not none must be selected:-
The integer i is passed from each checkbox in an onclick, to save a DOM lookup.

function checkNoti(i) {
  if ((!$('#notiEmail').prop('checked'))&&(!$('#notiSMS').prop('checked'))) {
    debug('ss');
    if (i==1) $('#notiSMS').prop('checked','true').checkboxradio("refresh"); else $('#notiEmail').prop('checked','true').checkboxradio("refresh");
    
  }
}
Last modified on Thursday, 19 September 2013 11:16

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.