Hussain Patel

Hussain Patel

  • 616
  • 1.8k
  • 531.5k

JQuery , javaScript ,ASP.NEt MVC

Sep 22 2016 9:52 PM
using jQuery find the value of last column in  the table and updated the checkbox in the first column based on the value in last column.
 
I have a table with first column name "Assign" having checkbox and last column name " assigned to". i have a button "Assign me" above the grid / table on clicking the button all the unassigned rows should be assigned be marked check box checked. .i.e if the value in last column is blank mean that is not assigned and first column should be checked.
 
This is what i have tried
    1. function selectAllUnassignedItems() {        
    2.     $("table[role='grid'] tr:not(:first)").each(function () {                     
    3.      var valueOfCell = $(this).find('td:last-child').text();                            
    4.    alert(valueOfCell);    
    5. //check if its greater than zero                 
    6. if (valueOfCell == ''){                     
    7.    //  how to get the first column value , the if condition is not getting true  
    8. }               
    9.  });    
    10. }     
 
 

Answers (1)