title: Change/push-one place next all input value onchange current input value
body: <p>I have a dynamic form with many inputs having different values, when any input is changed i want next values to shift down one place so that the value that is changed becomes next value and so on.</p>
  
  <p>Html</p>
  
  <pre><code>&lt;form name="top-download-update-edit"&gt;
  &lt;input name="v1" type="text" value="value1" /&gt;
  &lt;input name="v2" type="text" value="value2" /&gt;
  &lt;input name="v3" type="text" value="value3" /&gt;
  &lt;input name="v4" type="text" value="value4" /&gt;
  &lt;input name="v5" type="text" value="value5" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Say input v2 is changed to value6 like</p>
  
  <pre><code>&lt;input name="v2" type="text" value="value6" /&gt;
  </code></pre>
  
  <p>Now i want next all value to shift one place down like this.</p>
  
  <pre><code>&lt;input name="v1" type="text" value="value1" /&gt;
  &lt;input name="v2" type="text" value="value6" /&gt;
  &lt;input name="v3" type="text" value="value2" /&gt;
  &lt;input name="v4" type="text" value="value3" /&gt;
  &lt;input name="v5" type="text" value="value4" /&gt;
  </code></pre>
  
  <p>I am trying this way</p>
  
  <pre><code>$('#nav').on('change', 'form[name=update] input', function(){
      var input = $(this).val();
      $(this).next('input').val(input);
      //and some thing here to shift all next values one place.
  });
  </code></pre>
  
  <p>This does nothing.
  Please see and suggest any possible way to do this.</p>
  
  <p>Thanks.</p>
  
  <p><strong>Update</strong></p>
  
  <p>My actual codes.</p>
  
  <p>update.php</p>
  
  <pre><code>&lt;div id="update"&gt;
  
  &lt;form name="update" action="update-edit.php" method="post"&gt;
  
    &lt;?php $i=1; while($row = mysqli_fetch_assoc($result)):?&gt;
    &lt;label&gt;&lt;?php echo $i.'. ' ?&gt;&lt;input name="v&lt;?php echo $i; ?&gt;" type="text" value="&lt;?php  echo $row['title'] ?&gt;" /&gt;&lt;/label&gt;
    &lt;?php $i++; endwhile;?&gt;
  
    &lt;input type="submit" value="Submit" id="submit" /&gt;
  &lt;/form&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>jquery</p>
  
  <pre><code>$.post('../update.php',{value:value},function(data){
      $('#center-container').html(data);
  
      var v1 = $('input[name=v1]').val();
      var v2 = $('input[name=v2]').val();
      var v3 = $('input[name=v3]').val();
      var v4 = $('input[name=v4]').val();
      var v5 = $('input[name=v5]').val();
      var v6 = $('input[name=v6]').val();
  
      $("form[name=update]").data("values", {"v1": v1, "v2": v1, "v3": v3, "v4": v4, "v5": v5, "v6": v6});
  
      $('form[name=update] input').change(function(){
          var form = $(this).parent().parent();
          var name = $(this).attr('name');
          form.find('input').each(function() {
              var thisName = $(this).attr('name');
              var prevName = $(this).parent().prev('label').children('input').attr('name');
              if($(this).attr('name') &gt; name){
                  $(this).val(form.data('values')[prevName]);
              }
          });
          form.find('input').each(function() {
              form.data('values')[$(this).attr('name')] = $(this).val();
          });
      });     
  
  
  });
  </code></pre>