Front End Development Libraries Projects - Build a Random Quote Machine

Tell us what’s happening:

Describe your issue in detail here.
The Twitter Link will not load when I click the button. The href is opening a new tab but it wont bring me to Twitter. I get an error tab and a (Cannot GET /twitterLink)
Thank You FCC Team!

Your code so far

<wrapper id="quote-box">
  <div id="text"></div> 
   <div id="author"></div> 
    <button id="new-quote" onClick="generateQuote()">CLICK</button>
     <a href="twitterLink" id="tweet-quote" target="_blank">TWEET QUOTE</a>

</wrapper>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

Front End Development Libraries Projects - Build a Random Quote Machine

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.

function init() {
generateQuote()
}
function generateQuote() {
let quoteSize = quoteBank.length;
let randomIndex = Math.floor(Math.random() * quoteSize);
let randomQuoteData = quoteBank[randomIndex];

        let twitterLink = href="https://twitter.com/intent/tweet?hashtags=quotes&amp;related=freecodecamp&amp;text=%22When%20one%20door%20of%20happiness%20closes%2C%20another%20opens%2C%20but%20often%20we%20look%20so%20long%20at%20the%20closed%20door%20that%20we%20do%20not%20see%20the%20one%20that%20has%20been%20opened%20for%20us.%22%20Helen%20Keller"
        
        document.getElementById("tweet-quote").href = "twitterLink";
        document.getElementById("text").innerText="Random Quoter";
        document.getElementById("author").innerText="the author";
    }

I did fix the = href =

I also placed Twitter link in the a tag instead of a new variable in JS

Hi @ChadLaBombarde

Add the website for Twitter into the href attribute for the anchor element.
At the moment, it does not have the syntax for a website url, so maybe this is why it is failing the tests.

Also, it seems your code will post the same quote each time.

Happy coding

Thank You Teller.

I placed the link into the href and passed test number 10, which broke tests 6,7,8 and 9. lol. You’re correct, I do need to populate the “quoteBank” … hoping that will help pass 6,7,8 and 9.

Thanks again!

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.