使用jQuery获取跨度内的文本 [英] Get the text inside a span using jquery
本文介绍了使用jQuery获取跨度内的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个像<span id="myspan">1234 <a id="change"> </a> </span>
这样的span标签,现在我想使用jquery获得1234.有任何建议吗?如果我的跨度有一个ID?
I have a span tag like this <span id="myspan">1234 <a id="change"> </a> </span>
and now i want to get 1234 using jquery. Any sugeestion?? If my span has an id??
推荐答案
$('#change').parent('span').text()
或
$('span').text();
或
$('#myspan').text();
这篇关于使用jQuery获取跨度内的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文