title: How to Create Dynamic Object HTML and Assign Attribute Based Data Given
body: <p>I have dynamic object (button and textbox) create by jquery where each time I press Add Transport. I took this code from this forum and modify little bit to suit my situtions (thanks to whom create this code).</p>
  
  <p>Let me detail first regarding my dynamic items:</p>
  
  <p>My set of group data are <code>Trip[], Bus No[] and Amount[]</code> .
  This set can be multiple but consistent with 3 items only each group.</p>
  
  <pre><code>trip[] = button object
  busno[] = text object
  amount = text object
  </code></pre>
  
  <p>Below are my HTML script: </p>
  
  <pre><code>    &lt;div class="purchase-items-fieldset" style="clear:both;"&gt;
          &lt;div class="purchase-items-wrapper"&gt;
              &lt;div class="purchase-items"&gt;                            
                          &lt;ul&gt;
                          &lt;li&gt;
                          &lt;input type="button" name="trip[]" value="PB" class="field btn-field"&gt;
                          &lt;/li&gt;
                          &lt;li&gt;
                          &lt;input type="text" name="busno[]" class="field txt-field"&gt;
                          &lt;/li&gt;
                          &lt;li&gt;
                          &lt;input type="text" name="amount[]" class="field txt-field"&gt;
                          &lt;/li&gt;
                          &lt;/ul&gt;
                  &lt;input type="button" class="remove-line btn-remove" style="border:solid"&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;button type="button" id="btnAddTrans" class="add-field" style="display: none"&gt;Add field&lt;/button&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>Let says I have 2 set group data like below<code>***(mydata="PB,WBX001,1000,P,WBK001,500")***</code></p>
  
  <p>Then, my plan is:-</p>
  
  <pre><code>Group 1
  trip[]=PB
  busno[]=WBX001
  amount[]=1000
  
  Group 2 
  trip[]=P
  busno[]=WBK001
  amount[]=500 
  </code></pre>
  
  <p>where I want Jquery/Javascript create 2 group dynamic object and assign value each object base on plan above :-</p>
  
  <pre><code>function assigndatatrip (mydata) {
          //mydata="PB,WBX001,1000,P,WBK001,500"
          //each 3 item are 1 set group data etc: PB,WBX001,500
  
          //do split function and count how many set group
                   // create dynamic object
                   // assign data for dynamic object
          //loop
          //else no more data to assign then exit-return             
      }
  </code></pre>
  
  <p>I no idea where to start because I not so good on javascript/jquery function.</p>
  
  <p>I hope anybody who face this problem can share and help me how to solve this problem. Thanks on advance who's reading and reply this question.</p>
  
  <p>Thanks you.</p>