When I click on a div, I want to remove the last of its classes (which is always the third). Thus, when I click on the div below, I want to delete class 3, which may have different class names (but always ends with "_hover").
Is there an easy way to do this?
<div id="container" class="class1 class2 class3"> $('#container').on('click', function() { $(this).removeClass(?); }
source share