title: Give params to a div created via document.createElement
body: <p>I want to create multiple divs using a <code>for loop</code> which i do it like this</p>
  
  <pre><code>for(let i = 0; i &lt; data.length; i++) {
    let divs = document.createElement('div');
    divs.className = 'button';
    divs.data-id = (data[i]).id;                  // error
    document.body.appendChild(divs);
  }
  </code></pre>
  
  <p>Now my issue is that <code>data-id</code> is required but it pops an error. So how can I define <code>data-id</code> dynamically</p>
  
  <p>I also tried giving the whole div as innerHTML  of another div but then it wont render. So how can this be solved??</p>