title: How to pass a form input value into a JavaScript function
body: <p>I have a generic JavaScript function which takes one parameter</p>
  
  <pre><code>function foo(val) { ...} 
  </code></pre>
  
  <p>and I want to call the function when submit a form </p>
  
  <pre><code>&lt;form&gt;
  &lt;input type="text" id="formValueId"/&gt;
  &lt;input type="button" onclick="foo(this.formValueId)"/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>but the expression foo(this.formValueId) does not work (not surprised, it was a desperate attempt), So the question is, how can I pass a form value to the javascript function. 
  As I mentioned the javascript is generic and I don't want to manipulate the form inside it! </p>
  
  <p>I could create a helper function in the middle to get the form values with jQuery (for example) and then call the function but I was wondering if I can do it without the helper function.</p>