Add a parameter to a dynamic function
<p>I have a generic javascript class that creates an html input element.  The code allows me to pass a function as a string that will be called whenever the value of the element changes, using jQuery's change method.  I'm using the following code:</p>

<pre><code>1.  var changeFunction = "runThisCode()";
2.  
3.  var elem = $("&lt;input/&gt;").attr(id: someID, type: "text", size: 20);
4.  elem.change(function () {
5.     var fn = new Function(changeFunction);
6.     fn();
7.  });
</code></pre>

<p>I'd like to pass the id of the element in the change function. Is there a way for me to add a parameter at either on line 5 or 6?</p>
