I have 2 buttons
$(".button1").on("click", function(event){
$(".button2").on("click", function(event){
What I would like to do is start with button1 as clicked and have no event listener, when button2 is clicked the event listener is removed and the event listener for button 1 is activated.
This is a fairly common technique is in actionscript 3 with the method removeEventListener() and would like to use a similar method or technique in jquery.
If you want to remove an event handler bound with jQuery.on
then you probably want jQuery.off
http://api.jquery.com/off/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With