Saved X
Google login
SignUp with Email
X

Javascript set image src

theindreshverma ( Edited  Sep 30, 11:05 am )
Login

In javascript elememt.src="image_src"

Check how to

<!DOCTYPE html>
<html>
<head>
   <meta charset="utf-8">
   <title>Javascript set image src</title>
</head>
<body>
   <h1 align="center">Javascript set image src</h1>

   <img src="" id="i" />

<script>
document.getElementById("i").src = 'https://code.hikecdn.com/files/default.jpg';
</script>
</body>
</html>

Sourcecode Tags

More Sourcecodes

More Sourcecodes