So I am attempting to do the part about tweeting out the quote that is generated. I have the twitter button present and to start with it has a default href of: href=“https://twitter.com/intent/tweet?text=Hello%20world” just for testing.
When clicking the tweet button it opens another window with a tweet that has exactly what you would expect.
What I have done is created a jquery to hopefully update that href to instead of saying “hello world” in the tweet, to have the quote string.
The problem is that it is not updating.
Here is my jquery line:
I have also tried:
$("#twittershare").attr(“href”, newlink); (using the anchor link’s id attribute instead of the class)
I also tried to use replaceWith and I couldn’t figure that out either.
Still not having any luck… I click it after updating the quote and it still has the “hello world” in the pre-made tweet.
here is my codepen: https://codepen.io/travyy/pen/qYpXGQ
I assume its either something with the twitter button I am using or maybe you cant update href attr after the page is loaded or something weird like that… any ideas?