DOM/[removed] get text after tag

前端 未结 6 916
Happy的楠姐
Happy的楠姐 2021-01-05 00:59

How do I get the text \"there\" that comes after a tag in an html document:

hellothere

I see that the

6条回答
  •  一个人的身影
    2021-01-05 01:38

    Something like this?

    var p = document.getElementsByTagName("p")[0];
    alert(p.childNodes[1].textContent)
    

提交回复
热议问题