Basic I know, but how would / can you remove a url string using jquery?
Say for example, you use attr to atribute the image’s url string to a div called #picbox, how would you remove the first url string (say on the click function) and then re-attribute the second url string to the div?
var urlString1 = "images/1.jpg";
var urlString2 = "images/2.jpg";
$("#picbox").attr('src', urlString1);
$("#changeString").click(function(){
// remove urlString1 then replace with urlString2
});
No need to remove it. Setting a new
srcwill automatically remove the old one:For better performance, you should cache that selector: