title: creating dynamic fields and fill the data in it
body: <p>I have below JSON data and <code>HTML</code> form, in which dynamically fields get created. This form work to send the data. But how to fill the fields by dynamically creating them</p>
  
  <p><strong>json data</strong> </p>
  
  <pre><code>$data = {"1":"a","3":"b","5":"c","2":"d","4":"e"}
  </code></pre>
  
  <p><strong>index.php</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta http-equiv="content-type" content="text/html; charset=UTF-8"&gt;
      &lt;script type="text/javascript" src="http://code.jquery.com/jquery-compat-git.js"&gt;&lt;/script&gt;
  
      &lt;title&gt;Add/Remove Input Fields Dynamically with jQuery&lt;/title&gt;
      &lt;script type="text/javascript"&gt;
          $(function() {
              $('.multi-field-wrapper').each(function() {
                  var $wrapper = $('.multi-fields', this);
                  $(".add-field", $(this)).click(function(e) {
                      $('.multi-field:first-child', $wrapper).clone(true).appendTo($wrapper).find('input').val('').focus();
                  });
                  $('.multi-field .remove-field', $wrapper).click(function() {
                      if ($('.multi-field', $wrapper).length &gt; 1)
                          $(this).parent('.multi-field').remove();
                  });
              });
          });
      &lt;/script&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;form role="form" action="" method="POST"&gt;
          &lt;label&gt;Stuff&lt;/label&gt;
          &lt;div class="multi-field-wrapper"&gt;
              &lt;div class="multi-fields"&gt;
                  &lt;div class="multi-field"&gt;
                      &lt;select name="id[]"&gt;
                          &lt;option value="1"&gt;1&lt;/option&gt;
                          &lt;option value="2"&gt;2&lt;/option&gt;
                          &lt;option value="3"&gt;3&lt;/option&gt;
                          &lt;option value="4"&gt;4&lt;/option&gt;
                          &lt;option value="5"&gt;5&lt;/option&gt;
                      &lt;/select&gt;
                      &lt;input type="text" name="stuff[]"&gt;
                      &lt;button type="button" class="remove-field"&gt;Remove&lt;/button&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;button type="button" class="add-field"&gt;Add field&lt;/button&gt;
          &lt;/div&gt;
          &lt;input type="submit"&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>Any help will be appreciated.</p>