4

i have used code below on check box click. It works on local host but it not worked in mobile when i unchecked check box any one have 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();
    }
});

Thanks in advance

2 Answers 2

5

Because jQuery mobile uses all that fancy markup, you need to call a special jQuery mobile function to update the check box.

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

Works just fine. I think there are other ways to set the property, but make sure to include the refresh, otherwise jQm doesn't update the markup.

Sign up to request clarification or add additional context in comments.

Comments

0

have you tried the :checked selector?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.