title: Insert into HTML select tag options from a JSON
body: <p>So, here's the deal: I have a JSON object saved in my web App at localStorage.
  This JSON is being saved as a string, with <code>JSON.stringify</code>, inside one of my functions, on the page load:</p>
  
  <pre><code>localStorage.setItem("MyData", JSON.stringify(data));
  </code></pre>
  
  <p>data is being saved like this:</p>
  
  <p><code>[{"NAMEVAR":"Some Data 1","CODE":"1"},{"NAMEVAR":"Some Data 2","CODE":"2"}]</code></p>
  
  <p>data is the result from a request. The data is being saved successfully at the home page, so i could use later. After that, i have to load up a form on another page, using what i got from data.</p>
  
  <p>I have this select tag on the page:</p>
  
  <pre><code>&lt;select id="mySelectID" name="select" class="main-form"&gt;
  &lt;option value=""&gt;None Selected&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>What i want to do is simple: I'm using <a href="http://www.json2html.com/" rel="noreferrer">json2html</a> to add items to this select tag from the data, and the option value has the CODE from data.
  So, what i expected to happen is:</p>
  
  <pre><code>&lt;select id="mySelectID" name="select" class="main-form"&gt;
  &lt;option value="1"&gt;Some Data 1&lt;/option&gt;
  &lt;option value="2"&gt;Some Data 2&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>by doing this:</p>
  
  <pre><code>var jsonData = $.parseJSON(window.localStorage.getItem("data"));
  var transform = {tag:'option', id:'.CODE',html:'{$NAMEVAR}'};
  document.getElementById('mySelectID').innerHtml = json2html.transform(jsonData,transform);
  </code></pre>
  
  <p>But this does not work, and i know it won't. The problem is that i do not know how to insert this JSON into options to my HTML. I thought that json2html could help me, but as i do not speak English natively, it's kinda of being hard for me to understand that, and I'm also new to JavaScript.</p>
  
  <p>Thanks!</p>