こんなはずなのかわからないし、根本的に間違ったことをしている。
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/