I have following script and it works fine with FF and Safari.
function swapimage(cid) {
jQuery('.imageshadowlg').attr("src", jQuery(cid).attr("src").replace('/thumb/', '/final/'));
}
<a href='javascript:;' id='expic1link' onclick='swapimage(expic1)' ><img id='expic1' src='../gallery/pics/thumb/test.jpg' /></a>
In IE, I’m getting following error
SCRIPT5009: 'expic1' is undefined
Chrome is giving following error
Uncaught TypeError: Cannot call method 'replace' of undefined
swapimagegal.js:139
(anonymous function)s_gallery.aspx:1
onclick
These scripts are located in separate js file.
Any ideas?
When you pass any string as an argument it should be enclosed in quotes also the selector in the function is wrong. Try this