JQuery not working?

JQuery not working?
0

#1

Hey,
I’ve just started the Random Quote Machine project and although I followed the JQuery from the challenge, the button won’t work. Can someone please check if there is something wrong with what I wrote? And also I would like to try to write all the action in javascript because I am more comfortable with the syntax, but may be not right now. Hahaha… (I am so confused by this HTML/CSS thing)

Here is the project:

Thanks in advance.
:blush:

Update:
I got it to work with javascript but it would be nice to get the JQuery working. Send help please.


#2

jQuery isn’t working because you haven’t loaded it anywhere. The best place to load scripts and stylesheets on Codepen is in the settings for the CSS and JS panels. You can add those assets with ‘quick add’.

One thing to be wary of when using Codepen, is that it is wise to put all your CSS and JS in the separate panels, not mixed in with the HTML. When you have complete control over the code (i.e. you host it yourself) you know what order everything will be loaded - but with Codepen you don’t know what order they will render it all when they compile it. For example, if you include a script tag in a <head> element, and also load script in the JS panel, you don’t necessarily know if they will fire in the correct order. It’s still better practice when you host it yourself to put the css and js separate, but if you don’t, you can still see the order of execution more clearly.


#3

Oh my god… I am so remaking my quote page with the forismatic api.

Also… Good job looks nice. :thumbsup:


#4

Thank you. Can you show me yours when you are finish with it? I would love to see it.

I am struggling with it here lol.
I did hardcode my quotes and it feels easier because I understand the basic of it, but the whole Jquery thing sounds like an alien language to me.


#5

Thank you so much!

the js worked fine without loading so I thought it magically load it for me.