javascript - Get Row column text using jquery -


i trying text of input fields of each row , columns on save click button. rows can more one. want texts of rows , respective columns.i don't know how put in loop inputs values of more 1 row. below tried 1 row input value , getting undefined :

$('#btnsave').click(function() {     $("#tab_logic").find('tr').each(function() {         if ($(this).find('input[type="text"]')) {             var data1 = $(this).find('td:eq(0):input[type="text"]').val();             alert(data1);         }     }); }); 

any appreciated. in advance.

loop through each td , check if has text field using length peroperty,

$("#tab_logic tr td").each(function() {   if ($(this).find('input[type="text"]').length > 0)) {     var data1 = $(this).find('input[type="text"]').val();     alert(data1);   } }); 

to values array, use

var arr = $("#tab_logic tr td input[type='text']").map(function() {    return $(this).val(); }).get(); 

Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -