When to use parentheses with javascript function
<p>I have a function called <code>showText()</code> which copies some text from  form textbox to a paragraph elsewhere. It is called with the following:</p>

<pre><code>document.getElementById("mybutton").onclick = showText; 
</code></pre>

<p>It will not work if I add the () to the end of showText, which I understand from reading similar answers here is the only way to call a function. </p>

<p>Later in the script it requires the () to work:</p>

<pre><code>window.addEventListener("keypress", function(e) {
    var keycode = e.keyCode;
        if (keycode == 13 ) {
        showText();
        }
}, false);
</code></pre>

<p>I'm not sure what is going on here.</p>
