title: How to Dynamically Create a Submit Button with an "onclick" Event Attribute?
body: <p>I coded the following in order to produce a dynamic submit button that will send email when clicked, but it;s not working.</p>
  
  <pre><code>    function createbuttomdyanmic()
      {
  
          var button = document.createElement('input');
          button.setAttribute('type', 'submit');
          button.setAttribute('ID', 'btnSendMail');
          button.setAttribute('value', 'Send Mail');
          button.setAttribute('onclick', 'btnSendMail_Click');
          document.body.appendChild(button);
          button.setAttribute("class", "btn btn-primary");
          $('#button').addClass('myClass');
  
      }
  </code></pre>
  
  <p>Also, I need to add this style, but it is also not appearing.</p>
  
  <pre><code> margin-left:1407px;
      width:98px;
  </code></pre>