26
rated 0 times
[
28]
[
2]
/ answers: 1 / hits: 59870
/ 14 Years ago, mon, july 26, 2010, 12:00:00
I'm looping through cells in a table row. each cell has a text box in it, and I want to take the value of the text box and push it onto an array.
function dothing() {
var tds = $('#'+selected+' td');
var submitvals = new Array();
tds.each(function(i) {
var val = $(this).children('input')[0].val();
submitvals.push(val);
});
}
Theres more to the function, but this is all that is relevant. For some reason, when I run this code, I get HTMLInputElement has no method 'val'. I thought that input elements were supposed to have a val()
method in jQuery that got the value so this makes no sense. Am I missing something, or doing it wrong?
More From » jquery