My code satisfies the requirements. It works, so I marked it completed.
Even so, it’s not great. My Javascript is a mix of regular JS and jQuery, not what I would choose, but FCC didn’t teach how to do it all in JS. I don’t even understand some of the code I used.
First, here’s the URL to the Codepen, so you can view the code in full: https://codepen.io/LisaWillCode/pen/POGmaL
-
There are two main areas of code: the part that gets a randomly generated quote, and the part that gets a randomly generated background color. The quote part sits nicely inside a function. Every time I try to enclose the color part in a function, it stops working. (One of several reasons why I want it in a function is so it’ll generate a color on page load.)
-
I originally had the New Quote div as a button, but the button showed a square outline, even when I set the border to 0 or to 1px, same color as the button. Is there a way to get rid of that outline so I can change it back to a button?
-
I got the code for generating the random background color from a Dash project (from the coding bootcamp General Assembly), but I don’t actually know what it means. The line in question is:
var randomRGB = "rgb("+red+", "+green+", "+blue+")";
Full disclosure: I tried asking on another forum, but I didn’t understand the answer. I do get that the whole thing is a strong, so it’s all enclosed in quotes for that reason. What I don’t understand is the “+color+” parts. I was told it’s to concatenate them, but what is going on there? In regular concatenation, the plus signs aren’t inside quotes, and they’re not doubled. And why are there quotes inside of the main string quotes? How would I to generalize this to use it in another context?
I think there was another question, but my neighbor is blasting noise through the walls and I can’t think any more.