jquery - pushing checked rows and unchecked rows in a table into seperate arrays -


$('[name="selectgain"]').each(function () {      debugger;     var row = $(this).closest('tr');     var ischeck = $(this).parent().parent().find('input[type="checkbox"]').is(':checked');     if (ischeck) {         var gain = {             accountid: row.find('td:nth-child(3)').text(),             committedgaincomments: row.find('td:nth-child(6) > input').val()          };         commgainarea.push(gain);       }     else {         //var rows = $(this).closest('tr');         debugger;         var gain1 = {              accountid: row.find('td:nth-child(3)').text(),             committedgaincomments: row.find('td:nth-child(6) > input').val()          };           gainarea.push(gain1);       }  }); 

i have table in every row has check box in it.my requirement rows check box checked has passed 1 array ,all rows check box unchecked has passed array.

the above code working fine issue if check 1 row should have 1 element in particular array ,but above code getting same record twice

please me out. in advance.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -