Jquery如何获取某个元素前?后的文本内容?
<span>
text here...
<a >百万创想</a>
</span>
如何获得a标签前面的"text here"处的文本内容呢?
$("#target_element").parent().contents().filter(function(){
return this.nodeType == 3;
}).text();
- 上一篇 »php获取跳转后的真实链接
- 下一篇 »jQuery的属性与样式之样式操作.css,
<span>
text here...
<a >百万创想</a>
</span>
如何获得a标签前面的"text here"处的文本内容呢?
$("#target_element").parent().contents().filter(function(){
return this.nodeType == 3;
}).text();