JQuery InnerText not including sub element

前端 未结 4 1749
Happy的楠姐
Happy的楠姐 2020-12-03 23:39

Im wondering how I would get the text of a nested list item without getting the text of its children i.e.

  • I want t
4条回答
  •  伪装坚强ぢ
    2020-12-04 00:06

    Tim's solution will work. If your markup is always fixed in that format and you only need to read that first stretch of text up to the child element, you could even get away with simply:

    node.firstChild.data
    

提交回复
热议问题