How to change the value of an attribute using javascript

Posted by Manideepgoud under JavaScript category on | Points: 40 | Views : 1006
Here we are changing the src of an attribute of <img> element.
<img id="image1" src="apple.jpg" width="70" height="80"/>
document.getElementById('image1').src= "gauva.jpg";

In the above code we have image as "apple.jpg" with id as image1 and we are changing the src of <img> element to "gauva.jpg" ,

Comments or Responses

Login to post response