获取两个元素之间的文本JQUERY [英] Get text between two elements JQUERY
本文介绍了获取两个元素之间的文本JQUERY的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的申请表中有以下代码。
I have the following code in my application.
<div title="Please Click Here to Expand" class="technology3 closedlanguage" headerindex="0h">
<span class="accordprefix">
<img src="http:www.test.com/expanded.gif" style="width:13px; height:13px; margin-Right:20px">
</span>
Need this text<span class="accordsuffix"></span></div>
我需要在accordprefix和accordsuffix类之间获取文本,这是需要此文本
I need to get text between "accordprefix" and "accordsuffix" classes which is "Need this text"
为此我做了以下代码。
$(window).load(function(){
$(".accordprefix").each(function(){
alert($(this).next().html());
});
});
但它无效。请提供任何建议。
but its not working.Please give any suggestions.
推荐答案
您还可以查看
$.trim($($('.accordprefix')[0].nextSibling).text())
演示:小提琴
这篇关于获取两个元素之间的文本JQUERY的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文