【发布时间】:2016-10-11 19:38:46
【问题描述】:
所以我正在使用这样设计的网站:
<h2>
<span id="Explanation"> Explanation </span>
</h2>
<table> ... don't select anything in this table </table>
<a href="https://www.google.com/">hey</a>
<p> What's up? </p>
<p> How's life? </p>
<h2>
<span id="Transcript"> Transcript </span>
</h2>
<p> Don't select this </p>
我想使用 jQuery 选择解释标题和脚本标题之间的所有内容,但我无法获取任何文本。我目前得到这个的jQuery如下:
explanation = "";
explanation = $("h2 #Explanation").nextUntil("h2 #Transcript").text();
但现在,我根本没有选择任何文本。另外,我不确定如何只获取 a 和 p 文本而不是表格文本。各位大侠有什么帮助,不胜感激,谢谢!
【问题讨论】:
标签: javascript jquery html selector nextuntil