I am trying to implement something like this: https://www.w3schools.com/jsref/met_win_cleartimeout.asp
On my site: http://shawnwow.com/chineseCharacterHelpr/
If you type some letters on the left input, click on one of the characters, and then wait 5 seconds some images will appear (generated by doing a search on flickr).
I am trying to make it so that if they click on one character then click on another character before the 5 second timeout is done it will cancel the previous timeout and start off the new one. I am doing a workaround where I blow away the content in the tag before and after but for a moment it flickers through all the different images.
Here is where the JS starts: https://github.com/olmansju/chineseCharacterHelpr/blob/master/JS/scripts.js#L52
Mine was different than the one that is linked as similar because the command to clear timeout and to set the timeout is in the same click object. I saw many others where it was two different buttons.