jQuery在表中的br和td中选择文本 [英] JQuery Select text within br and td in table
本文介绍了jQuery在表中的br和td中选择文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使JQuery正确以从以下html结构中选择文本:
I'm trying to get the JQuery right to select the text from the following html structure:
<TABLE class=ms-formtable>
<TBODY>
<TR></TR>
<TR></TR>
<TR></TR>
<TR></TR>
<TR></TR>
<TR>
<TD><H3><NOBR>Select this text</NOBR></H3></TD>
<TD></TD>
</TR>
</TBODY>
</TABLE>
推荐答案
简单选择器
$('nobr').text();
更明确的选择器
$('table.ms-formtable > tbody > tr > td > h3 > nobr').text();
An example to play with
这篇关于jQuery在表中的br和td中选择文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文