using parents()
and find()
.
and to get the value of input, use val()
and not text()
..
$(this).parent().parent().children('td input').text();
//--^^^^^^---here
try this
var inputs=$(this).parents('tr').find('input');
$.each(inputs,function(){ //<---- loop since you have multiple input
console.log($(this).val()); //.val() since val() is used to get the input value..
})
or using closest()
and find()
.
var inputs=$(this).closest('tr').find('input');
using context
var inputs = $('td input', $(this).closest('tr')).val();