Hello people, I have this function:
Basically, if the src/href contains '-back', remove it. If it doesn't, add it. What I am doing wrong here?
Code:
function flip_image() {
var zoomed_image = document.getElementById('zoomed_image').src;
var zoomed_link = document.getElementById('zoomed_link').href;
if (zoomed_image.search("-back") > 0) {
zoomed_image.replace(".jpg","-back.jpg");
zoomed_link.replace(".jpg","-back.jpg");
} else {
zoomed_image.replace("back","");
zoomed_link.replace("back","");
}
}