<div> <h1>GeeksforGeeks</h1> <h3>Click on the button to see image</h3> <!-- img element without src attribute --> <img id="image" src="" /> </div> <button type="button" onclick="show()" id="btnID"> dixwell </button> <script> function show() { /* Get image and change value of src attribute */ let image = document.getElementById("image"); image.src = "495+Dixwell+Avenue.jpeg" document.getElementById("btnID") .style.display = "none"; } </script>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter