Leading Zeros Getting Dropped Using jQuery
<p>Using jQuery, I am copying a select into a ul for use in a mobile app.  Some of the values in the select options have leading 0s.  I'm using a custom attribute in the li elements to mimick the values in the select's options.</p>

<p>When I copy the value into the li:value, it loses the leading 0.  I've even tried creating the whole li as a liter string that I append to the outer ul.</p>

<pre><code>html:
&lt;select id="seltest"&gt;
&lt;option value="011111"&gt;good bye&lt;/option&gt;
&lt;/select&gt;
&lt;div id="container"&gt;&lt;/div&gt;

javascript:
$("#container").append("&lt;ul id='thefilter'&gt;&lt;/ul&gt;");

$("#seltest option").each(function () {
  var optval = $(this).val();
  var strvar = '&lt;li value=\"' + String(optval) + '\"&gt;' + $(this).text() + '&lt;/li&gt;';
  alert(strvar);
  $("#thefilter").append(strvar);
  var lastli = $("#thefilter li:last");
  alert(lastli[0].outerHTML);  // now the value has lost the leading 0
});
</code></pre>

<p>Here's a fiddle to show an example: <a href="http://jsfiddle.net/richbuff/4RbH9/7/" rel="nofollow">http://jsfiddle.net/richbuff/4RbH9/7/</a></p>

<p>Does anyone have an idea how to preserve the leading 0?  It seems like jQuery is modifying my text.</p>

<p>TIA!</p>
