Replace image not working after clicking


I am using a datepicker script and would like to replace the calendar image it uses. I can replace it by giving the image an ID and then replacing the image. It works, but when I click on the image, it displays the old image again. Is there a way I can replace the image after being clicked?

This is what I am using:

$('.ui-datepicker-trigger').attr('id', 'calendar');
$("img#calendar, .ui-datepicker-trigger").attr("src", "images/calendar.png");