+ Start a Discussion
Puja ChoudharyPuja Choudhary 

get the text value data for each row using jquery

I have a jquery popup window which has image , Dish name,quantity and price for various rows. I am able to fetch the data for each row and save in the back end. Now I want to add one text box in each row , showing the remarks .But I am not able to save the remark data from frontend to backend.

Code:
var products = ProductManager.getAllProducts();
      $.each(products, function(){
        var total = this.quantity * this.price;
        $cartTable.append(
          '<tr title="' + this.summary + '" data-id="' + this.id + '" data-price="' + this.price + '">' +
          '<td class="text-center" style="width: 30px;"><img width="30px" height="30px" src="' + this.image + '"/></td>' +
          '<td>' + this.name + '</td>' +
          '<td title="Unit Price">Rs ' + this.price + '</td>' +
          '<td title="Quantity"><input type="number" min="1" style="width: 70px;" class="' + classProductQuantity + '" value="' + this.quantity + '"/></td>' +
          '<td title="Total Amount" class="' + classProductTotal + '"> Rs ' + total + '</td>' +
          '<td title="remark">  <input type="text" id="txtREMARKS" placeholder="Enter your remarks" /> </td>' +
          '<td title="Remove from Cart" class="text-center" style="width: 30px;"><a href="javascript:void(0);" class="btn btn-xs btn-danger ' + classProductRemove + '">X</a></td>' +
          '</tr>'
        );

 
Puja ChoudharyPuja Choudhary
User-added image
David HalesDavid Hales
Hi Puja,
I have one example,
$('.chk').change(function () { 
  if($(this).is(':checked'))
  {
    $(this).closest('tr').find('td').each(
    function (i) {
      console.log($(this).text());
    });
  }
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="tablediv">
<table border="1" id="itemtable" align="center"> 
    <tr>
    	<th>check</th>
        <th scope="col">Item name</th>
        <th scope="col">Item code</th>
        <th scope="col">Supplier</th>
        <th scope="col">Received qty</th>
        <th scope="col">Accepted qty</th>   
        <th scope="col">Rejected qty</th>      
        <th scope="col">Remarks</th>             
    </tr> 
    <tr>
            <td><input type="checkbox" class="chk" ></td>
        <td>Pencil</td>
        <td>101</td>
        <td>Supplier</td>
        <td>10</td>
        <td>5</td>   
        <td>5</td>      
        <td>Remarks</td>             
    </tr>
     <tr>
            <td><input type="checkbox" class="chk" ></td>
        <td>Pen</td>
        <td>102</td>
        <td>Supplier</td>
        <td>25</td>
        <td>20</td>   
        <td>5</td>      
        <td>Remarks</td>             
    </tr>
</table>
</div>

either go through with
https://salesforce.stackexchange.com/questions/119723/get-row-data-in-text-field-when-we-click-on-row-in-apexpageblocktable
https://salesforce.stackexchange.com/questions/94771/visualforce-jquery-get-value-of-pageblocktable-cell
https://stackoverflow.com/questions/376081/how-to-get-a-table-cell-value-using-jquery
https://developer.salesforce.com/forums/?id=906F0000000AuGHIA0


if  didn't get any solution feel free communicate with me

If the above suggestion worked, let us know by marking the answer as "Best Answer" right under the comment which will help the rest of the community should they have a similar issue in the future. 

Thanks & Regards 
David Hales(1044)
Kloudrac Software Pvt. Ltd.