title: Jquery if checkbox is checked Bootstrap switch
body: <p>I use Bootstrap switch plugin to make my checkboxes looks like switch buttons. I need to check if the checkbox is checked in jQuery. I Googled a lot and I tried some advice and code snippets but without success.</p>
  
  <p>I think the cleanest code I found is </p>
  
  <pre><code>$('#checkbox').attr('checked');
  </code></pre>
  
  <p>but it still wont work on my website. I have declared jQuery in head. I try to use this snippets on non-bootstrap-switch-checkboxes but still no success.</p>
  
  <p><strong>JS:</strong>   </p>
  
  <pre><code> &lt;script&gt;
      $(function(){
        $(".odeslat").click(function(){
             $('#pozadavky').slideUp(100);
             $('#datumpick').slideDown(300);
  
         var typpaliva = 'nic';
         var malpg = 'nic';¨
  
         /***Important condition***/
  
         if ($('#uho').attr('checked')) {
              $.cookie("typpaliva", "Diesel");
         }
         else {
              $.cookie("typpaliva", "Benzin");
         }
  
  
   /**********************************************/
  
  
      $.ajax({
     url: 'http://podivej.se/script_cas.php',
     data: {druh: '30'},
     type: "POST",
     success: function(data){
              alert($.cookie('typpaliva')); 
              alert($.cookie('malpg'));   
     }
     });
  
    });
  });
  &lt;/script&gt; 
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;input type="checkbox" name="testcheckbox" id="uho"/&gt;
  </code></pre>