How do give specific conditions to different clicks in Jquery??🤔🤔 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 15

How do give specific conditions to different clicks in Jquery??🤔🤔

I want that if i click on a div element it shows a text (for ex. "hi" on first click) and on the other click show another text (Lets say "hello") and other on other clicks on the same element ???

18th Mar 2017, 12:44 PM
Nikhil
Nikhil - avatar
2 Answers
+ 4
I wrote you some codes for your question. See: https://code.sololearn.com/WLQtT68orFdP/?ref=app
6th Jun 2017, 3:22 PM
$machitgarha
$machitgarha - avatar
+ 4
A way could be: With each click: - increase a counter - use an array (or a swich-case, or a set of if-elses) with the different messages you want to show, using the counter to determine with of them to choose
18th Mar 2017, 2:10 PM
rarray
rarray - avatar