How to call a javascript-delegate with parameters?
<p>Lets say I have a javascript function call moveItem which takes two parameters source and destination.</p>

<p>I want to assign this function the the click-event of several buttons, each having different source and destinations.</p>

<p>OK, so without the parameter I would do something like this:</p>

<pre><code>$('#myButton1').click(moveItem);

function moveItem() {
...
}
</code></pre>

<p>But what if moveItem looks like this:</p>

<pre><code>function moveItem(source, destination) {
...
}
</code></pre>

<p>this doesn't seem to work:</p>

<pre><code>$('#myButton1').click(moveItem('foo','bar'));
</code></pre>
