Value gets passed to function without me clicking the button
<p>When I try to pass a value when a button is clicked the value gets passed anyway (even without me clicking the button). This is not supposed to happen because I want to hide an image only when the button is clicked
Why is this happening? </p>

<pre><code>for ( i = 0; i &lt; divs.length;i++){  
    knopdiv[i] = document.createElement('div');  
    divs[i].appendChild(knopdiv[i]);  
    knopdiv[i].innerHTML = '&lt;button id="knop' +i+'"&gt;Afbeelding verbergen&lt;/button&gt;';  
    knopdiv[i].onclick = hideMe(i, afb[i]);


function hideMe(nummer, afb){
console.log (nummer);
}
</code></pre>

<p>output without clicking: </p>

<pre><code>0
1
2
3
4
5
6
7
8
</code></pre>

<p>Why isn't console just passing the number of the clicked button? </p>
