Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Julien Arseneau
Full Stack JavaScript Techdegree Student 5,200 PointsWhy won't the citation change when the button is clicked
I am unable to change the citation when the button is clicked in the first project (Random Quote).
Julien Arseneau
Full Stack JavaScript Techdegree Student 5,200 PointsHere is a snapshot: https://w.trhou.se/o8i3xogyd3. I don't understand what is wrong with code inside the styles.js file.
4 Answers
Steven Parker
243,656 PointsDo you mean the "styles.css" file? Look at the line that loads it:
<link rel="stylesheet" href="css/styles.css">
This code is attempting to load the file from a sub-folder named "css", but your snapshot shows that you have no such folder in your file organization. You can either create one and move the file into it, or you can change the code to load the file in from where it is now.
Note that you have a similar issue with the loading of the JavaScript file. And once you get it loaded, it has a syntax error on this line:
//Here we choose our random quote
var UsedQuote = (getRandomQuote,1)[0];
Did you mean: quotes[RandomNumber] instead?
Julien Arseneau
Full Stack JavaScript Techdegree Student 5,200 PointsNo I wanted to stay script.js sorry.
Steven Parker
243,656 PointsBoth "styles.css" and "script.js" have the same issue with a missing sub-folder.
Julien Arseneau
Full Stack JavaScript Techdegree Student 5,200 PointsI think the folder didn't completely duplicate this workspace is better : https://w.trhou.se/xy6njx63rl . But unfortunately the quote still doesn't change.
Steven Parker
243,656 PointsIt will when you fix the syntax error I pointed out in my original answer.
Julien Arseneau
Full Stack JavaScript Techdegree Student 5,200 PointsI changed it but now it only works once. https://w.trhou.se/n8zmucb758
Steven Parker
243,656 PointsNow you have "quotes[(RandomNumber,1)]", which will indeed only change it once.
What I suggested was "quotes[RandomNumber]", which would change it each time, though it might occasionally pick the same one being shown.
Julien Arseneau
Full Stack JavaScript Techdegree Student 5,200 PointsThanks a lot!
Steven Parker
243,656 PointsSteven Parker
243,656 PointsTo make it possible to help, please show your (formatted) code and provide a link the course page you are working on.
You can share the entire project at once if you make a snapshot of your workspace and post the link to it here.