title: Add class to button inside a js function
body: <p>I want to create buttons and add classes to those button after creation
  I am working on below code !1 Please Help me out :) </p>
  
  <p>Will this work? </p>
  
  <pre><code>$("#"+element.id).addClass(".btn");
  </code></pre>
  
  <p>Thank you in advance !!</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>for (var i = 0; i &lt; 9; i++) {
    add(i);
  }
  
  function add(i) {
  
    var element = document.createElement("input");
  
    element.type = "button";
    element.value = i;
    element.name = i + 1;
    element.id = "btn" + i;
    element.onclick = function() {
      window.move(i);
    };
  
    var append = document.getElementById("append");
  
    append.appendChild(element);
    alert(element.id);
    $("#" + element.id).addClass(".btn");
  }</code></pre>
  </div>
  </div>
  </p>