Reputation: 1
HTML:
<table>
<tr>
<td>wddsa</td>
<td>dffs</td>
</tr>
</table>
JavaScript:
$('tbody tr').each(function() {
name2 = $(this).children("td:first").text;
alert(name2);
});
Returns a bunch function and jquery code. Possibly from jquery.min. What is wrong here?
Upvotes: 0
Views: 31
Reputation: 19759
You are accessing the actual function, rather than executing it. (.text
is a function, not a variable, so you need to execute it to get its return value .text()
).
name2 = $(this).children("td:first").text();
Upvotes: 1