Skip to content
Advertisement

JavaScript – capture img tags src in variable

im trying to store an image in HTML that comes from a url source in a variable using JavaScript. Could someone show me what code is required? i have started it off…

JavaScript

Advertisement

Answer

You can use the src property.

JavaScript

You can also use the src property to set a new URL for the image if you want to replace it.

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement