CodePen not working?

Hi all

So I’m a newbie and working through FCCs Javascript projects, but for the Random Quote Generator, which I assumed would be fairly simple, has me tearing my hair out because absolutely nothing I try will get the text to come up.

I’ve even resorted to copying and pasting other people’s code into mine exactly as it is on theirs and still nothing! Is there a setting I’ve overlooked, or perhaps some important piece of code I’m missing? I can’t for the life of me figure out what’s going on.

Any help would be very much appreciated

Thanks

hi,

you just need to add jQuery in settings and it’ll work.

Go to the pen settings, go to the javascript tab, choose jQuery from the drop down and hey presto :smiley:

For trouble shooting things like this, and anything for that matter, your first port of call should be the browser console.

In chrome, that’s f12 (or inspect element in the right click menu) and then chose the console tab. In there I saw an error saying $ was not defined. This is a dead giveaway that jQuery (which uses the $ selector to tell JavaScript it’s looking at jQuery) isn’t available to the rest of the script. Usually because it’s not been added correctly.

Also add bootstrap in the JS and CSS tabs, seeing as you are using some bootstrap selectors in your HTML.

Hope that helps

Mark

1 Like