title: Auto increment dynamic textbox div ID and result show in incremented div ID from another jquery?
body: <p>I use below script for dynamic textbox.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
       var counter = 0;
      $(function () {
      $("#btnAdd").bind("click", function () {
          var div = $("&lt;div /&gt;");
  
          div.html(GetDynamicTextBox(""));
          $("#TextBoxContainer").append(div);
      });
  });
  
  function GetDynamicTextBox() {
  
      return 'Item Code : &lt;select name="iuname" id="iuname" class="required"&gt;' + &lt;? php foreach($tItem as $row): ?&gt;
          '&lt;option value="&lt;?php echo $row-&gt;ProductID;?&gt;"&gt;&lt;?php echo $row-&gt;ProductID;?&gt;&lt;/option&gt;' + &lt;? php endforeach; ?&gt;
          '&lt;/select&gt;' +
          ' Batch : &lt;input id="buname" name="buname" &gt;' +
          '&lt;div id="ffinalResult' + counter + '" &gt;&lt;/div&gt;' +
          '&lt;br/&gt;'
      counter++;
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>When I'll change Item Code from drop down it will show result in ID= <code>ffinalresult</code>. It show result perfectly for first textbox. But when I change next drop down it show result in same div= <code>ffinalresult</code>.But I want to show result in different div ID for different drop down value. I use counter but its not working.</p>
  
  <pre><code>&lt;script&gt;
      $(document).on('change', '#iuname', function() {
          var val = $(this).val();
          var text = $(this).find('option:selected').text();
          $("#ffinalResult").text(val);
      });
  &lt;/script&gt;
  </code></pre>