RQM - Looking for feedback (and a little help...)

RQM - Looking for feedback (and a little help...)


Hi Campers!
I’ve pretty finished my Random Quote Machine. Have a look and tell me what you think.

I would like to completely disable the “random quote” button until the quote is typed out (if you try to click it during the animation you could see the bug), but it seems that the ‘disabled’ attribute only changes the appearance of the button whereas it continues to ‘listen’ at click events. If I use the .off() method, it properly disables the button, but I can not turn it on again. Any suggestion?


interesting idea, not sure I like it … but I’m an old fart who actually learned to type on a typewriter, so take no notice.
It’s responsive and code looks good, thumbs up!


One approach is to define a boolean, like isTyping, initial value is false.
During your display code (your oneByOne function), set isTyping = true at the beginning of the interval and set back to false when it’s finished.
Then take advantage of this by changing your click event code to check whether isTyping is true or false, and only call randomQuote() if isTyping is false.

I think this should work, there are probably other ways to do it too. Good luck, I like it.


to turn the button on again after calling off, use the on function.


Hi @yuzu-r and @nikrb . Thank you so much! Both your solutions work like a charm. I’ve read somewhere that it would be better to avoid to disable event handler if you have to use that later (off/on), but it works so I can’t understand why. The boolean solution seems to be better acknowledged and I tended to adopt this, but I’ve found a third solution that allows to save few lines of code. Maybe this could be helpful to someone else, so:
$("#getQuote").on('click', function() { if($("#getQuote").attr("disabled") == "disabled") { return }; randomQuote(); });
Thanks again! And sorry if I haven’t replied before.


Very nice, I like the theme. The only thing I would change is the typing speed. From a users standpoint, I wouldn’t want to wait for the quote to slowly type out (it disrupts the flow a little);