Hi! I'm trying to change an image class by clicking on it, like this:
- $('img.closed').click(function(){
- alert('I`m closed');
- $('img.closed').prop('class', 'open');
- }
- $('img.open').click(function(){
- alert('I`m open');
- $('img.open').prop('class', 'closed');
- }
Although after a click I see my image with a new class, the old handler is still being called. Why is it happening and how can I avoid it?