title: Create a button dynamically and set "onclick" handler with accepts multiple arguments
body: <p>I need to create a button in a loop dynamically and attach "onclick" event handler to it and then function for the handler is pre-defined and accepts multiple arguments.</p>
  
  <pre><code>for (var i = 0; .....) {
    var b = document.createElement("BUTTON");
    b.appendChild(document.createTextNode("fdsfdsfd_" + i)); 
    b.onclick = function() {
      var b = getB();
      var c = getC();
      myFunction(i, b, c);
    };
  
    document.appendChild(b);
  }
  
  
  
  function myFunction(a, b, c) {
  
  }
  </code></pre>
  
  <p>But when I inspect the thml, there's no "onclick" attribute.</p>
  
  <p>The property <code>innerHTML</code> doesn't fit for my case.</p>