title: Javascript function call with onclick
body: <p>I have a problem with this code, when I click the button it should do the function "hello" and open an alert but it doesn't work.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function hello(){
    alert("hi");
    }
  
  document.getElementById("one").onclick = hello();</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;button id="one"&gt;Click me &lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I know that I could simply do like this <pre>button onclick="hello()";</pre> but I need it to work with the javascript version. Basically my question is: Is there a way to open the function "hello" when I click the button without putting the onclick in the button tag??</p>