How to stop click event after perticular number of clicks? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to stop click event after perticular number of clicks?

As given example executes number of times(number of clicks)..so what to do if i wanna stop click event after 5 clicks.so that it can stop executing and final answer shows the 5th click generated answer.

4th Jul 2017, 7:21 AM
Pooja N. Pawar
Pooja N. Pawar - avatar
1 Answer
+ 13
var clicks = 0; function buttonClick() { clicks++; if (clicks <=5) { // Your Code } }
4th Jul 2017, 8:19 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar