Passing function as argument with variables inside - possible?
<p>Code: </p>

<pre><code>function remove_comment(){
    var id = "bla";
    Msg().prompt( "blabla" , function(){ Ajax().post( "id=" + id ) } , id );
}

Msg().prompt( txt , fn , args ){
    $( elem ).click( fn );
}
</code></pre>

<p>As you can notice, I need to pass this function to prompt(), while inside the passed function one of the arguments depends on the variable <code>id</code>.</p>

<p>Now, after the function passed I need it to be assigned to an element's onclick event (the code abode is not using jQuery).</p>

<p>First, I'd tried to do this:
<code>$( elem ).click( fn.apply( this , id ) );</code>,
<code>$( elem ).click( fn.call( id ) );</code>, but these codes execute the function immediately (I already know why, no need to explain).
Then I'd tried to play with the function and arrange it as string to pass directly as <code>onclick='THE_FUNCTION'</code> html code to the element, but with no success.</p>
