jQuery change child text

前端 未结 5 1396
不知归路
不知归路 2021-01-17 19:51

I have a jquery function that changes a text inside a element using a jquery \"text\" function. Inside this td element is child \"a\" tag like this.

5条回答
  •  情书的邮戳
    2021-01-17 20:08

    Wrap the text in a span element, and change the text in the span.

    bar link
    ... $('#foo span').text('new text');

    Edit:

    Or use $('td.v3 a').text("new text") to change the text in the anchor, if that's what you want to do.

提交回复
热议问题