title: $( elem ).attr("checked") giving opposite results
body: <p>Clicking checkbox should give alert checked if checked and give alert not checked if not. Here is the code:</p>
  
  <pre><code>&lt;input type = "checkbox" id = "all" value="all" /&gt; MyCheckbox
  
   &lt;script src="jquery-2.1.4.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      $("input[type=checkbox]").click(function(){
      if ($(this).attr("checked")) {   
  alert("checked");
  }
  else{
  alert("not checked");
  }
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>Initially checkbox is unchecked. As soon as I click it, debugger shows it checked value true. Now control should enter if{} block as its value is true but its entering in else{} block. (Am using breakpoints).</p>
  
  <p>Why this is happening. Pls help am trying for hours. </p>