I have an element contained in a parent element with a class active, for example:
<div class="active">
<div class="button"></div>
</div>
I have jQuery configured to handle clicks on my buttondiv, but only if this div is contained by the parent active, for example:
$('.active .button').click(function(){
alert('Button clicked!');
});
I use jQuery to remove the class activefrom the parent, and even after deleting the class, a warning still appears when I click the button. This seems very unusual since the button no longer meets the selection criteria. This happens in Chrome, Firefox, and IE, so this seems to be intentional behavior. Am I missing something? or is there at least an easy way around this?
JSFiddle : http://jsfiddle.net/KjuDy/. . active, . , , active . , , .