Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想通过只知道类名来获取跨度的值。在文档中,该类只有一个跨度。我试过这样:
$('span.foo').text();
但它不返回任何东西。我怎样才能做到这一点?
演示
对我来说很好
<span class="foo"> bar </span> <script> alert($('span.foo').text()); </script>