Dear Sir
pls refer
in this screen
click select product
When I click i get id name as foodiv0
My Jquery Script
- $('[id^="foodiv"]').change( function() {
- $('#cls').text($(this).attr("id"));
- var thisid=this.id;
- alert("product id0="+thisid);
- $('#cls').append($('#'+thisid).val());
- });
i am getting alert foodiv0 i had changed dropdown or select whose id is product 0
this drop down is slected dynamically
Code that populates the row and dropdown
- function addItem() { /* function to add a row */ ;
- var rowcount=$('#rowcount').val();
- var rc=parseInt(rowcount);
- $('#rowcount').val(rc+1);
- var url= "add2sessionvariable.php";
- data = {
- rowcount : rowcount
- }
-
- $('#add2sessionvariable').load(url,data) ;
- var rowclass="rowclass"+rowcount;
- var row="row"+rowcount;
- var itemRow =
- '<div class="s-12 l-12">'+
- '<div class="s-12 l-1 dropdown " id="srnodiv'+rowcount+'" style="padding:20px;" ><input name="srno'+rowcount+'" id="srno'+rowcount+'" type="text" class="'+rowclass+'"> </div>' +
- '<div class="s-12 l-3 dropdown " id="foodiv'+rowcount+'" style="padding:20px;" > </div>' +
- '<div class="s-12 l-1 dropdown " id="qtydiv'+rowcount+'" style="padding:20px;" ><input name="qty'+rowcount+'" id="qty'+rowcount+'" type="text" class="'+rowclass+'"> </div>' +
- '<div class="s-12 l-1 dropdown" id="ratediv'+rowcount+'" style="padding:20px;" ><input name="rate'+rowcount+'" id="rate'+rowcount+'" type="text" class="'+rowclass+'"> </div>' +
- '<div class="s-12 l-1 dropdown " id="amountdiv'+rowcount+'" style="padding:20px;" ><input name="amount'+rowcount+'" id="amount'+rowcount+'" type="text" class="'+rowclass+'"> </div>' +
- '<div class="s-12 l-2 dropdown delete" id="delete'+rowcount+'" style="padding:20px;font-size:18px; cursor:pointer;"> X Delete </div>' +
-
- '</div>';
- $("#pblock").append(itemRow);
-
- $('#productdiv'+rowcount).text(rowcount);
-
- //$('#committeeposition'+rowcount).text(rowcount);
-
- var url= "add2productdropdown.php";
- data = {
- rowcount : rowcount
- }
- $('#foodiv'+rowcount).load(url,data);
- //var url= "add2committeepositiondropdown.php";
- // data = {
- // rowcount : rowcount
- // }
- //$('#committeeposition'+rowcount).load(url,data);;
-
-
-
- }
- addItem(); //call function on load to add the first item
- /////// company name ////
- $('#companyid').change ( function() {
- var companyid= $('#companyid').val();
- var url= "companydetailfill.php";
- data = {
-
- companyid: companyid // COmpany id is passed //
- }
- $('#companydetaildiv').load(url,data, copytodeliveryaddress) ;
-
- });