Change the value of the image's src attribute - Javascript jQuery

Javascript examples for jQuery:Image

Description

Change the value of the image's src attribute

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("img").attr("src", "http://java2s.com/resources/a.png");
});//from   w w  w.  j  a va 2 s.  c  o  m
</script>
</head>
<body>

<img id="image" src="http://java2s.com/resources/b.png" width="284" height="213">

</body>
</html>

Related Tutorials