Get JS output in HTML after pressing a button

Get JS output in HTML after pressing a button
0.0 0

#1

I am building my random quote machine and I can get JS to work as I want.
I want, after pressing a button (which is actually a div inside a tags) to run a specific JS function and then get the output of that function in the quote div, how is that possible? I have tried different things so far but nothing works as I want, thanks!!


#2

When the page loads, your current code replaces the inner html of the div with id=“quote” with the value returned from a call to the spawn function.

If you want something to happen when you click an element, you should read about addEventListener.