How to change image src (<img src="...") with JavaScript

1 Answer

0 votes
<!DOCTYPE html>
<html>

<head></head>

<body>

<img id="img-id" src="images/users/avibootz3.jpg">

<script>

document.getElementById("img-id").src = "images/users/noabootz5.png";

/*
run:

The image changed from avibootz3.jpg to noabootz5.png 

*/

</script>

</body>

</html>

 



answered Jul 7, 2015 by avibootz

Related questions

1 answer 176 views
1 answer 156 views
3 answers 494 views
494 views asked Nov 26, 2017 by avibootz
...