I want to assign content of the src tag of image to a variable on clicking on the image through JS: Eg-
HTML
<img src="image.jpg" id="img">
<span id="source"/>
JS ???
I want to assign the image source "image.jpg" to a variable and then load it through id "source" when I click on the image in HTML. How can I do it?
Thanks in advance.