开发者

jQuery - Selecting the value of a span via classname

I want to get the value of a span by开发者_如何学JAVA knowing only the class name. In the document there is only one span with that class. I tried like this:

$('span.foo').text();

But it doesn't return anything. How can I do that?


demo

works fine for me

<span class="foo"> 
bar 
</span> 
<script> 
alert($('span.foo').text()); 
</script>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜