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.
我试过代码:
$('a').hasClass('button-hello').hover(function() { alert('ffs'); });
我试过这个,没有成功。我试图触发悬停在类中有按钮-hello 的任何 A 链接上。
以下代码:
$('a.button-hello').hover(function() { alert('ffs'); });
将处理以下元素:
<a href="#" class="button-hello">A1</a> <a href="#" class="button-hello a">A2</a> <a href="#" class="button-hello a b">A3</a> <a href="#" class="button-hello a b c">A4</a>
JsFiddle.net 示例