title: Javascript Window Function Pass "this" as Parameter
body: <p>I am looping thru a JSON object and I want to set clicks on fields based on a function named in the JSON Object. The function called will by window[] will be parameterised instead of hardcoded.</p>
  
  <pre><code>           for (var key in JSONOBJ) {
  
                 func = window["minRule"](this);
  
                 $('#'+ key).click(func);
  
             }
  </code></pre>
  
  <p>The function being called is</p>
  
  <pre><code>function minRule(elem){
  
  
   alert(elem.name);
  
  
  }
  </code></pre>
  
  <p>and I want it applied to </p>
  
  <pre><code>&lt;input type='text' name='FIELDINJSONOBJECT' id='FIELDINJSONOBJECT'/&gt;
  </code></pre>
  
  <p>However when I refresh the page the function is being called for some reason and hasnt binded to the click. Also the alert(elem.name) is returning undefined. How do I pass this as the parameter to a function called with window[$FUNCTIONAME]</p>
  
  <p>Regards,
  Tom</p>