Hi,
I'm trying to remove a script added by setTimeout(). I tried to use clearTimeout() but seems like it's not working.
This is what should happen: Click Btn1 to include the function for btn2. After btn1 is clicked, click Btn2. An alert will be displayed. When btn1 is clicked again, the previous function added by settimeout should be cleared. And another function for btn2 will be added. Click on btn2, only one alert should be displayed.
But what happens on my end is when I click btn1 two times, the alert for btn2 is displayed twice too. Shouldn't the previous function for btn2 be remove since I used clearTimeout in btn1 too?
Here' the jsfiddle for my problem: http://jsfiddle.net/goo2gvmj/
Any help will be greatly appreciated.
Thanks!