lundi 27 février 2017

get table rows only when table checkbox is "checked"

I am using below code to get the values of selected row using check box class = btnSelect; but i want to get the rows only when the checkbox is marked as checked. Current code get the values , both when checkbox checked and unchecked.Someone please help me on how to change the code to get the required thing

$("#itemtable").on('click','.btnSelect',function(){
                     // get the current row 
                         alert("i am inside dddd");
                        var currentRow = $(this).closest("tr"); 

                        var col1 = currentRow.find("td:eq(0)").text(); // get SI no from checkbox
                        var col2 = currentRow.find("td:eq(1)").text(); // get item name
                        var col3 = currentRow.find("td:eq(2)").text(); // get item code
                        var col4 = currentRow.find("td:eq(3)").text(); // get supplier
                        var col5 = currentRow.find("td:eq(4)").text(); // get received qty
                        var col6 = $(currentRow).find("td:eq(5) input[type='text']").val(); // get accepted qty
                        var col7 = $(currentRow).find("td:eq(6) input[type='text']").val(); // get rejected qty
                        var col8 = $(currentRow).find("td:eq(7) input[type='text']").val(); // get remarks
                       
                        var data=col1+"\n"+col2+"\n"+col3+"\n"+col4+"\n"+col5+"\n"+col6+"\n"+col7+"\n"+col8;
                        
                        alert(data);
                       });



Aucun commentaire:

Enregistrer un commentaire