create checkboxes dynamically in JavaScript
<p>I'm trying to create check boxes dynamically. But I have no idea what is the wrong with this code. Somebody please help. Comment if you need more details.</p>

<pre><code>$.getJSON(url, function(json) {
  console.log(json);
  console.log(json.items.length);

  for (var i = 0; i &lt; json.items.length; i++) {

    console.log(json.items[i].name);

    var checkbox = document.createElement('input');
    checkbox.type = "checkbox";
    checkbox.name = "name" + json.items[i].name;
    checkbox.value = "value";
    checkbox.id = "id" + i;
  }
});
</code></pre>

<p>Thank you</p>