こんなはずなのかわからないし、根本的に間違ったことをしている。
div特定のクラスを持つがあり、divそれをクリックすると応答が返されますが、別divのクラスをクリックすると、最初のクラスからクラスが削除されdivます。
divただし、クラスを削除した後、最初のクラスをクリックし続けると、応答が返されます。
クラスを削除した後もクリックが反応し続けるのはなぜですか?
HTML
<div class="testing">Testing</div>
<div id="testing_remover">Remove class from testing</div>
JS:
$(document).ready(function(){
$('.testing').click(function(){
console.log('testing is active');
});
$('#testing_remover').click(function(){
$('.testing').removeClass('testing');
});
});
フィドル: http: //jsfiddle.net/P3NpK/