Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

187
Views
How to display data in table row after selecting data from another row

I need to display item code after selecting description in every row. the first row works fine, but after adding 2nd,3rd rows it doesn't work.

<script>
$(document).ready(function(){
/*add new row in table after clicking the addrow button*/
var count = $(".itemRow").length;
$(document).on('click', '#addRows', function() {
count++;
  var htmlRows = '';
   htmlRows += '<tr>';
   htmlRows += '<td><div class="custom-control custom-checkbox"><input type="checkbox" class="custom-control-input itemRow" id="itemRow_'+count+'"> <label class="custom-control-label" for="itemRow_'+count+'"></label> </div></td>';
   htmlRows += '<td><select name="itemcode[]" id="itemcode" class="form-control form-control-sm loadIcode" autocomplete="off" disabled style="width:50%"><option value=""></option></select></td>';
   htmlRows += '<td><select name="description[]" id="itemname" class="form-control form-control-sm loadIcode" autocomplete="off" style="width:50%"><option value="" disabled selected>Select Item Description<?php echo fill_description($connect);?></option></select></td>';
   htmlRows += '</tr>';

  $('#invoiceItem').append(htmlRows);
  $('.loadIcode').change(function(){
   if($(this).val() != '')
   {
    var loadIcode = $(this).attr("id");
    var query = $(this).val();
    var result = '';
    if(loadIcode == "itemname")
    {
      result = 'itemcode';


    }
    $.ajax({
     url:"result.php",
     method:"POST",
     data:{loadIcode:loadIcode, query:query},
     success:function(data){
      $('#'+result).html(data);
     }
    })
   }
  });
 });
});    
</script>

enter image description here

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!