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>
精彩评论