simple jquery image change onclick failing
- by ian
I have a simple jQuery image switch that is failing.
$('.heart_img').click(function()
{
var heart_type = $(this).attr('src');
//alert( heart_type );
if ( heart_type == 'images/unheart.png')
{
//alert('uheart');
$(this).attr('src','images/heart.png');
}
else if ( heart_type == 'images/heart.png');
{
$(this).attr('src','images/unheart.png');
}
});
The alerts fire correctly when not commented out so and the images are in the correct place so I am not sure what the problem is.