javascript - How do I turn off a function using jQuery? -


I have two buttons (on and off) when I click on "ON", then I call "turnover" I want to turn on a function called , and when I click on "off", I want to close the function. I have it now:

  $ ("body"). ("Click", "#turnOn", turnToolOn); $ ("Body"). Closed ("click", "# turnoff", turntone); The () function is working on  

, but when I click on "off", I still can not seem to stop working my performance.

You need to wrap your on / off events in the "click" event, and the actual element Use the ID of which you are using as a button

So, if you have a button & lt; Button id = "turn on" & gt; On & lt; / Button & gt; and & lt; Button id = "turnoff" & gt; Closed & lt; / Button & gt; :

  $ ("#turnOn"). Click (function () {$ ("body") .on ("click" TurnToolOn)}); $ ("# Turnoff"). Click (function () {$ ("body") .off ("click", turnToolOn)});  

Read more!


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -