How To Efficiently Change Image Attribute "src" From Relative Url To Absolute Using Jquery?
I need to change the src for an html image tag from relative to absolute url. I am using the following code. urlRelative and urlAbsolute are created correctly but I cannot modify
Solution 1:
Try like this
$(this).attr("src", urlAbsolute)
Solution 2:
Try $(this).attr("src", urlAbsolute);
Solution 3:
jQuery("#my_image").attr("src", "first.jpg")
Solution 4:
Solution 5:
Instead of below code:
$(this).attr("src").replace(urlRelative, urlAbsolute);
Use this:
$(this).attr("src",urlAbsolute);
Post a Comment for "How To Efficiently Change Image Attribute "src" From Relative Url To Absolute Using Jquery?"