Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 6
Stop function javascript
I would like to stop function if user click on a button. I know there is 'return' but it does nothing... function abc () { $('.stop').click (function () { return; }); } $('.start').click (function() { abc (); }); example : how to stop the abc function after the user click to .start and decided to click to .stop ?
4 Respostas
+ 5
Use jquery .on() and .off() functions to add or remove an event handler.
+ 5
Unless abc is in a setInterval function, it should be pointless to stop a function which would take a fraction of second to be executed
+ 4
en fait t'as un menu, si tu click sur
-easy : Ƨa fait cette fonction. une fois la game terminƩe Ƨa te demande 'restart' ou 'menu'
si tu reviens dans menu et que cette fois tu choisis 'medium', Ƨa executera pas la mĆŖme fonction. mais Ƨa continue Ć exexuter la fonction 'easy'...
faut que je fasse UNE seule fonction avec un Switch {} dedans ?
+ 4
Pas obligatoirement
Tu peux changer la difficultƩ avec seulement des variables par exemple
Mais pour stopper la fonction j'aurais besoin d'en savoir plus sur la structure de ton code dƩsolƩ