title: How to get the value of all inputs in a form
body: <p><strong>Code:</strong></p>
  
  <pre><code>&lt;form name="newform" action="test.php" method="post"  class="form-horizontal input-prepend" id="newform"&gt;
  
    &lt;div class="form-group"&gt;
      &lt;label class="control-label" for="test1"&gt;test1&lt;/label&gt;
      &lt;input type="text" name="test1" class="form-control" id="test1" placeholder=""&gt;
    &lt;/div&gt;
  
    &lt;div class="form-group"&gt;
      &lt;label class="control-label" for="test2"&gt;test2&lt;/label&gt;
      &lt;input type="text" name="test2" class="form-control" id="test2" placeholder=""&gt;
    &lt;/div&gt;
  
  &lt;div class="form-group"&gt;
      &lt;label class="control-label" for="test3"&gt;test3&lt;/label&gt;
      &lt;input type="text" name="test3" class="form-control" id="test3" placeholder=""&gt;
    &lt;/div&gt;
  
  &lt;div class="form-group"&gt;
      &lt;label class="control-label" for="test1"&gt;test4&lt;/label&gt;
      &lt;input type="text" name="test4" class="form-control" id="test4" placeholder=""&gt;
    &lt;/div&gt;
  
  &lt;div class="form-group"&gt;
      &lt;label class="control-label" for="test5"&gt;test5&lt;/label&gt;
      &lt;input type="text" name="test5" class="form-control" id="test5" placeholder=""&gt;
    &lt;/div&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>In order to get an input's value, we can use its <code>id</code>, for example <code>alert($("#test5").val())</code>, but how to get the input value sequentially from the beginning of the form when we do not know the <code>id</code> of the input?</p>
  
  <p>For my test code I can get value using code:</p>
  
  <pre><code>var value1 = $("test1").val();
  var value2 = $("test2").val();
  var value3 = $("test3").val();
  var value4 = $("test4").val();
  var value5 = $("test5").val();
  </code></pre>
  
  <p>Does anyone have any ideas about how to get values when we don't know an input's <code>id</code>?</p>