Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Duplicate of this: Check this fiddle with check box in list view included with data-icon.</p> <p><a href="http://jsfiddle.net/ek2QT/184/" rel="nofollow">http://jsfiddle.net/ek2QT/184/</a></p> <p>markup:</p> <pre><code>&lt;ul data-role="listview" data-theme="c" data-dividertheme="d"&gt; &lt;li&gt; &lt;div class="checkBoxLeft"&gt; &lt;input type="checkbox" name="checkbox-0" id="checkbox-0" class="hidden-checkbox"/&gt; &lt;/div&gt; &lt;a href="#" class="detailListText"&gt;Message 1 &lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;div class="checkBoxLeft"&gt; &lt;input type="checkbox" name="checkbox-1" id="checkbox-1" class="hidden-checkbox" checked="checked" /&gt; &lt;/div&gt; &lt;a href="#" class="detailListText"&gt;Message 2 &lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Code:</p> <pre><code>$('#index').live('pagebeforeshow',function(e,data){ $('input[type="checkbox"]').each(function(){ ($(this).is(':checked')) ? $(this).parent().parent().addClass('checked') : $(this).parent().parent().addClass('not-checked'); }); }); $('.checkBoxLeft').bind('click', function(e) { if($(this).find('input[type="checkbox"]').is(':checked')){ $(this).removeClass('checked').addClass('not-checked'); $(this).find('input[type="checkbox"]').attr('checked' , false); } else { $(this).removeClass('not-checked').addClass('checked'); $(this).find('input[type="checkbox"]').attr('checked' , true); } }); </code></pre> <p>CSS:</p> <pre><code>.detailListText{ margin: 0 0 0 20px; } .checkBoxLeft{ position: absolute; left: 10px; top: 28%; width: 18px; height: 18px; background: #d9d9d9; border-radius: 3px; } .hidden-checkbox { display: none; } .not-checked, .checked { background-image: url("http://www.dragan-gaic.info/elements.png"); background-repeat: no-repeat; } .not-checked { background-position: 18px 0; background-color:#d9d9d9; } .checked { background-position: 0 0; background-color:#6496bc; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload