"Refresh" event handler?

"Refresh" event handler?

Hi! I'm trying to change an image class by clicking on it, like this:
  1. $('img.closed').click(function(){
  2.       alert('I`m closed');
  3.       $('img.closed').prop('class', 'open');
  4. }

  5. $('img.open').click(function(){
  6.       alert('I`m open');
  7.       $('img.open').prop('class', 'closed');
  8. }

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?