用jQuery选择内部文本 [英] Select inner text with jQuery
本文介绍了用jQuery选择内部文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<div class="boxen checkedzahlen" id="box41_0_1">
41
<input type="checkbox" value="1" name="cb41_0_1" id="cb41_0_1" checked="checked"/>
</div>
给出了类似的内容,如果单击了$(this)
(类为boxen
),如何为文本41
设置动画?
Something like this is given, how can I animate the text 41
, if $(this)
(the class boxen
) is clicked?
this > *
不起作用. this:children
都没有.
this > *
doesn't work. Neither does this:children
.
推荐答案
由于标题有些混乱,某些人(例如我)可能会遇到此问题,以寻找如何获取文本内容 DOM元素.您可以通过以下方式完成此操作:
Because of the slightly confusing title, some people (like me) may be coming to this question looking for how to get the textual content of a DOM element. You can accomplish this by:
$("#myselector").text() // returns the content of the element as plain text
这篇关于用jQuery选择内部文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文