JavaScript onChange not working using DOM element : <p>I got a problem when trying to make onchange listener for input in JavaScript:</p>

<pre><code>var apple = document.getElementById("apple");
apple.addEventListener("change", validate("apple"));

function validate(fruitName){
    var qty = parseInt(document.getElementById(fruitName).value);
    console.log(qty);
}
</code></pre>

<p>I am trying to check everytime when the user input something for 'apple' input, I will print the quantity at console. But by doing this, It only ran the first time when I refreshed the browser by printing out a NaN and does not work even when I changed the input for 'apple'.</p>

<p>Any ideas?</p>

<p>Thanks in advance.</p>
