Tell us what’s happening:
every time you click the new qutoe btn the data being passed through takes longer to load with every press.
Your code so far
https://codepen.io/gsparmar/pen/mdrvWRB
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36.
Challenge: Build a Random Quote Machine
Link to the challenge:
Learn to code. Build projects. Earn certifications.Since 2015, 40,000 graduates have gotten jobs at tech companies including Google, Apple, Amazon, and Microsoft.
sanity
January 19, 2021, 5:14pm
2
Take a look at the jquery click method, it might not be behaving the way you expect.
1 Like
I switched it to inline onClick=“getQuote()” - and it fixed the issue.
isn’t the jquery click method a shorten version for on.(“click”, handler)??
also TY!
sanity
January 19, 2021, 5:33pm
4
It is and similarly to on it doesn’t just set event handler for the element, but with each call it adds a new one. As click was called in the function called after pressing button, with each press of the button additional event handler was added to the element.
1 Like
system
Closed
July 21, 2021, 5:33am
5
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.