Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
158
rated 0 times [  162] [ 4]  / answers: 1 / hits: 34604  / 9 Years ago, thu, march 12, 2015, 12:00:00

How we can find all the inputs of a td inside a tr in jquery.
I have tr that will have multiple td in that td i have inputs and select so i want to get the values of the input types
Code :



$('div#divid tbody.tbodyClass tr.trClass').each(function() {
$(this td).find(input:text,select).each(function() {
textVal = this.value;
inputName = $(this).attr(name);
formData+='&'+inputName+'='+textVal;
});
InsideCount++
});


I am trying to use this td's with each but i am not able to get the values and name of the inputs.


More From » jquery

 Answers
1

You have syntax error at $(this td). td should be used in find selector:



$(this).find(td input:text,td select).each(function() {
textVal = this.value;
inputName = $(this).attr(name);
formData+='&'+inputName+'='+textVal;
});
InsideCount++


as tds will be the only direct child of trs , you can narrow down the selector to:



 $(this).find(input:text,select).each(function() {

[#67464] Wednesday, March 11, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
andrewb

Total Points: 259
Total Questions: 124
Total Answers: 90

Location: Ivory Coast
Member since Sun, Mar 7, 2021
3 Years ago
;