I thought this would work, but whenever I click on the element with the class name of one and it changes to the class named two, I can’t get the second event to work. What am I missing here?
//first event
$('.one').on('click', function () {
$('.one').attr('class', 'two');
});
//second event
$('.two').on('click', function () {
$('.two').attr('class', 'one');
});
Why not more simple
:)http://jsfiddle.net/XZeNE/1/ or this http://jsfiddle.net/4mJJe/use API –
toggleClassFurther HTML CHange Dmeo http://jsfiddle.net/vuLQK/1/
code
HTML change