Lost with Random Quote Machine

Lost with Random Quote Machine
0

#1

I’ve been working on this project on and off for weeks. I finally got some headway to be blocked once more.

Since I couldn’t figure out how to connect a JSON file to the project, I went with the array route.

Before I could click the button, it would come up with a blank space. Since I’ve edited the files so many times from that point, I don’t remember what I had originally written.

Of course now, when clicking the button, it won’t change the quote or even bring back the blank space.

The following is the JS file from

 var quote = document.querySelector("#quote");
 var person = document.querySelector("#person");
 var twitter = document.querySelector("#twitter");
 var newQuote = document.querySelector("#newQuote"); //this is the newQuote button

 var quotes = [
     {
         "quote": "Insert quote here",
         "person": "Insert person here"
     } //There are multiple quotes listed in this area and each one follows this template
 ];

  //when the button is pressed, a new quote appears
  var randomNumber;
  var randomQuote;
  getQuote();
      function getQuote() {
          randomNumber = Math.floor((Math.random() * quotes.lenght));
          randomQuote = quotes[randomNumber];
          $(quotes).text(randomQuote);
      }

 /*newQuote.addEventListener("click", function () {
      var printQuote = quotes[Math.floor(Math.random() * quotes.length)];
      document.querySelector(quote, person).innerHTML = printQuote;
      //replace quote and person with new quote and person once newQuote      button is clicked
  });*/

Somehow, I’ve gotten the Twitter button to work and I’ve tried following that code as a template, but that didn’t work either.

I’m the first person to admit my JS skills are considerably lacking. The second code set with the newQuote.addEventListener is another idea I had but I don’t know if it’ll work.

Any help would be greatly appreciated.