title: Why is the "checked" attribute not true when checkbox is triggered?
body: <p>In the following code using jQuery:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$("input").change(function(evt) {
    console.log("change event handler invoked", evt);
    console.log($("input").is(':checked'));
    console.log($("input").attr("checked"));
    console.log($("input").prop("checked"));
  });
  
  $("input").trigger("click");
  $("input").trigger("click");</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;input id="the-input" type="checkbox"&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>the <code>is(':checked')</code> and <code>prop("checked")</code> can both show a true but the `attr("checked") will show undefined.  I thought they are to be the same?  (even if we manually click on the checkbox, it is the same effect).</p>
  
  <p>Also, if I set the <code>checked</code> in HTML so that the checkbox is checked by default (<a href="http://jsfiddle.net/UcGyM/1/" rel="nofollow noreferrer">http://jsfiddle.net/UcGyM/1/</a> ), now the <code>attr("checked")</code> will print out <code>checked</code> for both triggering, so it won't be able to tell whether it is checked or not -- why is that?  (it is also strange that both shows <code>checked</code>, but <code>$("input").attr("checked", true);</code> or <code>$("input").attr("checked", false);</code> can turn it on or off.)</p>
  
  <p>A related question is, if we want to insist on using <code>attr("checked")</code>, does that mean in the HTML, it has to have the <code>checked</code> attribute: <code>&lt;input type="checkbox" checked&gt;</code>, if so, how can it specify the attribute but with it defaulted to off?  (because <code>checked="false"</code> or <code>checked=""</code> or <code>checked="0"</code> will not make it unchecked by default.</p>