Select box won't populate with javascript
<p>I am using javascript to populate a select box in my page but its not working, the select box displays but its completely empty.</p>

<p>I also get no error in my console.</p>

<p>My script is this:</p>

<pre><code>        var select = document.createElement("select");
            for(var i in resource){
                if(i !== id &amp;&amp; select.hasOwnProperty(i)){
                    select.setAttribute(i, resource[i].name);
                }
            }
            d.appendChild(select);
</code></pre>

<p>Example data for <code>resource</code>:</p>

<pre><code>{
 "1":{"name":"Test"},
 "2":{"name":"Test2"},
 "3":{"name":"Test3"}
}
</code></pre>

<p>Any ideas on why it won't populate?</p>
