title: Jquery get form field value
body: <p>I am using a jquery template to dynamically generate multiple elements on the same page. Each element looks like this</p>
  
  <pre><code>&lt;div id ="DynamicValueAssignedHere"&gt;
      &lt;div class="something"&gt;Hello world&lt;/div&gt;
      &lt;div class="formdiv"&gt;
          &lt;form name="inpForm"&gt;
              &lt;input type="text" name="FirstName" /&gt;
              &lt;input type="submit" value="Submit" /&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I would like to use Jquery to process the form on submit. I would also like to revert the form values to their previous values if something should go wrong. My question is
  How can I get the value of input box using Jquery? For example, I can get the value of the div with class "something" by doing</p>
  
  <pre><code>var something = $(#DynamicValueAssignedHere).children(".something").html();
  </code></pre>
  
  <p>In a similar fashion, I want to be able to retrieve the value of the textbox. Right now, I tried</p>
  
  <pre><code>var text = $(#DynamicValueAssignedHere).children(".formdiv").findnext('input[name="FirstName"]').val();
  </code></pre>
  
  <p>but it doesn't seem to be working</p>