Use jQuery.data to get a boolean from a dom element?
<p>According to <a href="http://api.jquery.com/data/#data2" rel="nofollow">jQuery's .data() documentation</a> you can use the .data() method to <code>data</code> prefixed attributes from a dom element. For example:</p>

<pre><code>{# Include jquery.... #}
&lt;div id='mydiv' data-foo='bar'&gt;&lt;/div&gt;
&lt;script&gt;
    var foo = $('#mydiv');
    foo.data('foo');   // == 'bar'
&lt;/script&gt;
</code></pre>

<p>That said, I'm curious how you set and pass boolean values in these dom objects. As far as I know, this does <strong>not</strong> work:</p>

<p><strong>Throws a javascript error:</strong></p>

<pre><code>{# Include jquery.... #}
&lt;div id='mydiv' data-foo=false&gt;&lt;/div&gt;
</code></pre>

<p><strong>Sets a string instead of a boolean:</strong></p>

<pre><code>{# Include jquery.... #}
&lt;div id='mydiv' data-foo='false'&gt;&lt;/div&gt;
&lt;script&gt;
    var foo = $('#mydiv');
    foo.data('foo');   // == 'false'
&lt;/script&gt;
</code></pre>

<p>So, how do I set boolean values in the dom? <em>Or</em>, do I have to convert these string values to booleans in my javascript (which seems lame)?</p>
