How do I display a picture when I press a button? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How do I display a picture when I press a button?

11th Jun 2019, 7:56 AM
takeru
takeru - avatar
6 Answers
+ 10
JS can do. Set display propety of image to none in css. And then change it to block using JS. Read comments in code https://code.sololearn.com/WBTByw2yEDQz/?ref=app
11th Jun 2019, 8:19 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 5
takeru If you don't want JS 😿 Then you'll have to use css hover selector. But then you can't use button ,just hover https://code.sololearn.com/WBi3sjk59mQl/?ref=app
11th Jun 2019, 9:48 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 1
Thank you! But is there a way not to use js?
11th Jun 2019, 8:55 AM
takeru
takeru - avatar
+ 1
I understand what you say. I think I need to learn more about JS.Thank you.
11th Jun 2019, 11:31 AM
takeru
takeru - avatar
0
takeru There isn't. All buttons require 'functions'. Otherwise, they wouldn't do anything. CSS ir HTML don't do such things, they are merely the 'decoration' tools of your page. So JS only for any buttons
11th Jun 2019, 9:33 AM
River
River - avatar
0
can 'ontarget' be the same as' onclick' ?
12th Jun 2019, 6:00 AM
Ginfio
Ginfio - avatar