title: jQuery .data() does not return boolean value; why?
body: <p>I'm very unexperienced jQuery programmer unable to find a bug in my trivial script. Could you please help?</p>
  
  <p>I want to emphasize a checkbox if its state differs from the initial value. That initial value is stored as <code>data-init</code> attribute. The generated html for checked and unchecked input looks like this:</p>
  
  <pre><code>&lt;td&gt;&lt;input checked data-init id="controls-0-modeU" name="controls-0-modeU" type="checkbox" value="y"&gt;&lt;/td&gt;
  
  &lt;td&gt;&lt;input id="controls-1-modeU" name="controls-1-modeU" type="checkbox" value="y"&gt;&lt;/td&gt;
  </code></pre>
  
  <p>In the accepted answer here: <a href="https://stackoverflow.com/questions/9921076/retrieve-boolean-data-from-data-attribute-in-jquery">Retrieve boolean data from data attribute in jquery</a> there is: "<em>The jQuery <code>.data()</code> method is smart about recognizing boolean and numeric values and converts them into their native type</em>". That is what I want.</p>
  
  <p>My script begins with:</p>
  
  <pre><code>$(document).ready(function(){
          $("td input:checkbox").change(function(){
              var $init = $(this).data("init")
  </code></pre>
  
  <p>But the value of <code>$init</code> is either <code>undefined</code> (for initially unchecked input) or an empty string (for initially checked). Both of them evaluate to false. Why am I not getting true/false instead?</p>