I\'m trying to get an image to swap on the click event of a div class using jQuery .attr from the original image source location of \"Images/origImage\" to a new image source lo
I've implemented something similar using the background style, I wonder if this would help you out. I split out the img variable explicitly:
background
$("div.xxx").click(function(){ var img = 'path/toNew.jpg'; $('.changesrc').attr('style', 'background: url(' + img + '); ') });