How to create a JavaScript alert using image tag ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to create a JavaScript alert using image tag ?

24th Feb 2018, 8:58 AM
Akash Pawar
Akash Pawar - avatar
5 Answers
+ 5
<img src='photo.jpg' alt='photo' onclick='alert("hello world")'>
24th Feb 2018, 9:07 AM
Amethyst Animion
Amethyst Animion - avatar
24th Feb 2018, 9:02 AM
Michael55555
Michael55555 - avatar
+ 3
https://code.sololearn.com/WKxUcVEVGHWZ/?ref=app this code might worked
24th Feb 2018, 9:12 AM
Akash Pawar
Akash Pawar - avatar
+ 2
created by michael and edited by me
24th Feb 2018, 9:13 AM
Akash Pawar
Akash Pawar - avatar
+ 2
@Akash Pawer It only works if the image doesn't exist:\
24th Feb 2018, 9:27 AM
Michael55555
Michael55555 - avatar