0

How to make Button image

Wanna create a button that hide and show image whenever it is clicked.

23rd Feb 2020, 6:01 AM
AbdulRasheed Lekan Adekeye
AbdulRasheed Lekan Adekeye - avatar
6 Answers
+ 4
AbdulRasheed Lekan Adekeye Here replace <p> with <img> https://code.sololearn.com/WOhWj5qPvT7b/?ref=app For DOM manipulation use jQuery,it will make it easy $("button").on("click", ()=>{ $("img").toggle() })
23rd Feb 2020, 7:10 AM
Sudarshan Rai
Sudarshan Rai - avatar
+ 1
Can you show us your attempt?
23rd Feb 2020, 6:02 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 1
Can you write anything then? Just a code that shows an image an a button at least.
23rd Feb 2020, 6:08 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 1
<!DOCTYPE html> <html> <head> <script> function myimg() { document.getElementbyId("click").innerHTML; show.this("art.jpg"); } </script> <title>image</title> </head> <body> <input id = "click" type="button" value ="Click Here"/> </body> </html>
23rd Feb 2020, 7:04 AM
AbdulRasheed Lekan Adekeye
AbdulRasheed Lekan Adekeye - avatar
0
No idea
23rd Feb 2020, 6:04 AM
AbdulRasheed Lekan Adekeye
AbdulRasheed Lekan Adekeye - avatar
0
Sudarshan Rai 👑 thanks it works
23rd Feb 2020, 8:05 PM
AbdulRasheed Lekan Adekeye
AbdulRasheed Lekan Adekeye - avatar