Jquery Mobile 1.2 Multiple Checkbox Selection Issue

Posted by user1819957 on Stack Overflow See other posts from Stack Overflow or by user1819957
Published on 2012-11-13T04:58:04Z Indexed on 2012/11/13 4:59 UTC
Read the original article Hit count: 138

Filed under:

I'm coding a Jquery Mobile 1.2, Jquery 1.8.2, css, and HTML 5 based app that I need to allow the user to select multiple images and execute a command.

The following works if I do NOT use the jquery.mobile-1.2.0.min.js library:

CSS Code: .image-checkbox-container input[type="checkbox"]{ display: none; }

.image-checkbox-container img{
    border: 0;
    margin: 4px;
 }

HTML:

JQuery: $('.image-checkbox-container img').live('click', function(){ if(!$(this).prev('input[type="checkbox"]').prop("checked")){ $(this).prev('input[type="checkbox"]').prop("checked", true); this.style.border = '4px solid #38A'; this.style.margin = '0px'; }else{ $(this).prev('input[type="checkbox"]').prop("checked", false); this.style.border = '0'; this.style.margin = '4px'; } });

As soon as I add in the jquery.mobile-1.2.0.min.js library to the code it does not function correctly anymore. The unchecking/unselecting of the checkboxes does not work.

I attempted to use the checkboxradio("refresh") but did not have any luck.

Any suggestions would be much appreciated.

Thanks

© Stack Overflow or respective owner

Related posts about jquery-mobile