だから私は、要素がホバーされている場合にのみ何かを行う .hover() メソッドを使用しようとしていますが、特定のクラスはありません。HTMLで問題の要素にクラスを追加するとうまくいきます。しかし、.addClass() を使用して jQuery を使用してクラスを追加するクリック イベントがあるとします。hover() メソッドは、追加されたクラスを無視します。十分なとりとめ。これがコードです。
$('.foo:not(.bar)').hover(function() {
someCrap(); //when hovering a over .foo that doesn't also have the class .bar, do someCrap
}
$('.foo').click(function(){
$(this).addClass('bar'); //after the element .foo gets another class .bar, the hover event written earlier continues to work, WTF
})
男と女のアイデアはありますか?