Get second td of tr using jquery

后端 未结 5 2117
攒了一身酷
攒了一身酷 2021-02-12 10:54

I\'m trying to get td values of tr.. but unfortunately it\'s not working.. may be there is something wrong

My html looks like

         


        
5条回答
  •  野的像风
    2021-02-12 11:11

    jQuery find() method returns the descendants of the selected element. You are already selecting the with a class of dname and then trying to find a descendant which is also a .

    https://api.jquery.com/find/

    The following should work:

    jQuery(".dname").find("td:eq(1)").text();
    

    Edit: text() instead of val() as @freedomn-m pointed out

提交回复
热议问题