Find td with specific text, and operate on the td right after that one?

前端 未结 6 670
逝去的感伤
逝去的感伤 2020-12-19 04:13

I\'m not very familiar with jQuery selectors, so would like some help.

I have a table like this:

6条回答
  •  南笙
    南笙 (楼主)
    2020-12-19 04:54

    My initial answer missed the point about updating the text, here is a sample with this included:

    $(".test td:contains(Heading 1)")
        .next().text(function(){
            return $(this).text() + " Hello"
        });
    

    I don't believe you can use the append method as I think it only works to add html tags.

提交回复
热议问题