title: How to programatically check this iphone style checkbox?
body: <p>I am using <a href="http://awardwinningfjords.com/2009/06/16/iphone-style-checkboxes.html" rel="nofollow">this</a> iphone style checkbox. All checkboxes are checked by default. If it is unchecked, a modal is shown, which has a form and all. When I close this modal, I want the checkbox to be enabled again.</p>
  
  <p>This is the JS that shows the modal when the checkbox is changed to false:</p>
  
  <pre><code>$(window).load(function() {
    var onchange_checkbox = $('.on_off :checkbox').iphoneStyle({
      checkedLabel: 'Confirm',
      uncheckedLabel: 'Edit',
      onChange: function(elem, value) {
          if($(elem)[0].checked==false){
              $('.modal').show();
              $("body").append('&lt;div class="modalOverlay"&gt;');
          }
      }
    });
  });
  </code></pre>
  
  <p>This is the table of checkboxes:</p>
  
  <pre><code>%{for(int i=0;i&lt;confirmAtt.size ();i=i+9){}%
  &lt;tr&gt;
  &lt;td&gt;${confirmAtt.get(i)}&lt;/td&gt;
  &lt;td&gt;${confirmAtt.get(i+1)}&lt;/td&gt;
  &lt;td&gt;${confirmAtt.get(i+2)}&lt;/td&gt;
  &lt;td&gt;${confirmAtt.get(i+3)}&lt;/td&gt;
  &lt;td&gt;${confirmAtt.get(i+4)}&lt;/td&gt;
  &lt;td&gt;${confirmAtt.get(i+5)}&lt;/td&gt;
  &lt;td&gt;${confirmAtt.get(i+6)}&lt;/td&gt;
  &lt;td&gt;${confirmAtt.get(i+7)}&lt;/td&gt;
  &lt;td&gt;${confirmAtt.get(i+8)}&lt;/td&gt;
  &lt;td class="modalInput on_off"&gt;&lt;input type="checkbox" id="on_off_${i}"
      checked="checked" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  %{}}% 
  </code></pre>
  
  <p>The modal with the close button:</p>
  
  <pre><code>    &lt;div class="modal" id="aModal"&gt;
          &lt;p&gt;
              &lt;button class="close" onclick="foo();"&gt;Close&lt;/button&gt;
          &lt;/p&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>which calls this function:</p>
  
  <pre><code>function foo(){
      $('.modal').hide();
      $('.modalOverlay').remove();
      onchange_checkbox.prop('checked', !onchange_checkbox.is(':checked')).iphoneStyle("refresh");
      //tried changing this line to
      //$('.on_off').attr("checked" , true);
      //doesn't work
  }
  </code></pre>