title: How can I get the value of an input field in javascript without submitting a form?
body: <p>I'm fairly new to javascript and have a question about how to get a value of an input field without submitting a form. I have the following small piece of code, which I'm using in combination with a realtime-validation script to validate the fields.</p>
  
  <pre><code>&lt;form name="FormName" method="post" /&gt;
      &lt;input type="text" id="nameValidation" value="HelloWorld" /&gt;
      &lt;script type="text/javascript"&gt;
         var NameValue = document.forms["FormName"]["nameValidation"].value;
      &lt;/script&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I want the var NameValue to be the value of what you type into the input field so I can use it in the message which appears after the validation. When I change the value of the input field without submitting the form, the var NameValue is stil set to "HelloWorld". After doing some research I found out I could solve it using jQuery and it's function serialize(). Is there a way to do this without jQuery?</p>