Im trying to figure out how to get this random quote function to work inside a div or a p tag. I found the function on google, but I want to figure out how to get it to run wherever I want it to instead of at the very top of my page. Ive been looking at a few beginner tutorials that have got close to explaining how to do this but I can’t get it to work for me… I know that inside the function, it has a ‘document.write’ and im guessing that’s what’s causing it to write at the top of my page but Im having trouble figuring out what I can replace that with to get it to execute the way I want.
If you look at my HTML, I created an empty
tag at the end of my body that I want the function to run in. Ive tried doing:
and calling the function this way but no luck. What am I doing wrong? Why isn’t this working? Can someone please explain this to me so that I can understand and learn how to get functions to associate within specific tags?