当前位置: 代码迷 >> 综合 >> How to get the nearest parent node given a text node in jQuery?
  详细解决方案

How to get the nearest parent node given a text node in jQuery?

热度:5   发布时间:2024-01-10 01:36:04.0

http://stackoverflow.com/a/2879467/2177408


Any element or text node is a Node, which has a parentNode property. You don't need jQueryfor this but you can turn the parent into a jQuery object:

$(textNode.parentNode)...
  相关解决方案