title: The button don't do the function
body: <p>I've made a button using javascript, but the onClick event I've set does not seem work.</p>
  
  <p>Here is my code:</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>function myFunction() {
    console.log('button pressed')
  }
  
  var BUTTON = document.createElement("button");
  BUTTON.name = "not";
  BUTTON.type = "button";
  BUTTON.onclick = "myFunction()";
  var textBUTTON = document.createTextNode("TEST");
  BUTTON.appendChild(textBUTTON);
  var output = document.getElementById("test");
  output.appendChild(BUTTON);</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="test"&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>The button which is created by javascript appears, but the function, <code>myFunction()</code>, doesn't do anything. </p>
  
  <p>If I make the button manually, with HTML, it works as expected</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>function myFunction() {
    console.log('button pressed')
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;button name="not" type="button" onClick="myFunction()"&gt;TEST&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>