Sepoto Sepoto - 6 months ago 23
jQuery Question

jQuery getting the value of the second through tenth td of the clicked tr in a table. I already have the first

$("#existcustomers tr").click(function () {
var td1 = $(this).children("td").first().text();

I need the value of td2-td10 as well. I can't seem to figure out how to accomplish this. I tried using
in the same fashion but that seems to be breaking the programming. Does anyone know how this would be accomplished for the following td's?


To get a specific cell by index, you can use :


To get the first 10 children, use :


If you want to get the content in separate cells of an array, you can do

var texts = $(this).children(":lt(10)").map(function(){return $(this).text()});

This makes an array like this :

["contentofcell1", "cell2", "3", "cell 4", "five", "six", "sieben", "otto", "neuf", "X"]