How to use many times onclick function in html | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula gr√°tis
+ 5

How to use many times onclick function in html

I know use onclick function one time but I don't know how to use onclick function many times in a button please any one tell me.

23rd Sep 2019, 8:27 AM
CODE LINEūüĒč
CODE LINEūüĒč - avatar
18 Respostas
23rd Sep 2019, 1:20 PM
NiKiūüĆłūüíē
NiKiūüĆłūüíē - avatar
+ 4
Use addEventListener https://code.sololearn.com/W5aSVP7L2z4Z/?ref=app Try to do the assignment in this lesson.
24th Sep 2019, 9:51 AM
Gordon
Gordon - avatar
+ 2
`onclick` event is triggered when an element is (duh) clicked. How many times the event is triggered depends on how many times the element is clicked. I think I'm not getting what you mean by using the event handler function many times here, can you elaborate on this idea further?
23rd Sep 2019, 9:42 AM
Ipang
+ 1
IRON MANūüíĽ Okay I see the code, can you tell me what you want to do with multiple clicks on that image?
23rd Sep 2019, 10:33 AM
Ipang
+ 1
What is the problem? I still don't understand what you want here. Don't give me just 'Yes' I don't get it. BTW sometimes the second image isn't showing up when the image is clicked, but it could be my connection problem.
23rd Sep 2019, 10:37 AM
Ipang
+ 1
OK then you need some logic - if (img == img1) {show img2} else {show img1}
23rd Sep 2019, 10:53 AM
HNNX ūüźŅ
HNNX ūüźŅ - avatar
0
Please send me a code for example.
23rd Sep 2019, 9:43 AM
CODE LINEūüĒč
CODE LINEūüĒč - avatar
0
Please
23rd Sep 2019, 9:44 AM
CODE LINEūüĒč
CODE LINEūüĒč - avatar
0
I thought you said you know how to use it at least one time? please elaborate on the necessity to run the event handler function multiple times. Do you have a code related to this question? can you share it in your original question Description above? hopefully more responses can come having a code to review. (Edited)
23rd Sep 2019, 9:48 AM
Ipang
0
Ok . Jast a minute
23rd Sep 2019, 10:16 AM
CODE LINEūüĒč
CODE LINEūüĒč - avatar
23rd Sep 2019, 10:21 AM
CODE LINEūüĒč
CODE LINEūüĒč - avatar
0
Yes
23rd Sep 2019, 10:33 AM
CODE LINEūüĒč
CODE LINEūüĒč - avatar
0
Ok I told you in detail
23rd Sep 2019, 10:44 AM
CODE LINEūüĒč
CODE LINEūüĒč - avatar
0
I want . I am click on image first time I seen second image . But I click on second image I want to seen first image.
23rd Sep 2019, 10:47 AM
CODE LINEūüĒč
CODE LINEūüĒč - avatar
0
I don't understand what are you saying.
23rd Sep 2019, 11:59 AM
CODE LINEūüĒč
CODE LINEūüĒč - avatar
0
Please tell me in detail
23rd Sep 2019, 12:00 PM
CODE LINEūüĒč
CODE LINEūüĒč - avatar
0
And try to give me a code example please.
23rd Sep 2019, 12:00 PM
CODE LINEūüĒč
CODE LINEūüĒč - avatar
0
You can use jquery
23rd Sep 2019, 3:42 PM
Rhea
Rhea - avatar