Get second child using jQuery

前端 未结 9 1565
灰色年华
灰色年华 2020-12-12 15:03
$(t).html()

returns

test1test2

I want to retrieve the second td<

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-12 15:58

    In addition to using jQuery methods, you can use the native cells collection that the gives you.

    $(t)[0].cells[1].innerHTML
    

    Assuming t is a DOM element, you could bypass the jQuery object creation.

    t.cells[1].innerHTML
    

提交回复
热议问题