jquery exclude some child nodes from .text()

前端 未结 4 1084
醉话见心
醉话见心 2020-12-18 22:19

The html structure looks like this

parent may contain text
child 1 may contain text
4条回答
  •  自闭症患者
    2020-12-18 22:53

    Try this:

    ($('#parent').text()).replace($('#parent script').text(),'');
    

    Check out this Fiddle.

提交回复
热议问题