Send form data to Javascript on submit
<p>Ok I feel like this should be really simple; so either I've completely missed the point of the questions on here and other websites I've read or it hasn't been asked in the same context.... </p>

<p>I have a REALLY simple form element (below) </p>

<pre><code>&lt;form&gt;
  &lt;input type="text" id="searchTerm" /&gt;
  &lt;input type="submit" value="Submit" id="submitButton" /&gt;
&lt;/form&gt;
</code></pre>

<p>And essentially all I want to do, when the <code>Submit</code> button is clicked, is have the value entered into the <code>text</code> box passed to a <code>JavaScript Function</code> and console logged (for now). </p>

<p>This looks like it has been asked a million times but the questions I've read don't answer my question (I don't think). </p>

<p><strong>Edit</strong> Thank you for all the responses; the biggest problem is I was trying to reference a function in an external <code>Javascript</code> file that was being called after the form element. </p>