I’ve almost finished my Random Quote Machine but I’m having a strange problem. When I try to share quote on twitter, it adds up “p” tags on my quote. First quote is same everytime, but when you click new quote button it generates new quote. This new quote when shared on twitter adds “p” tags. Please suggest any solution for it. Below is the codepen link to my random quote generator.
I think you need to add backticks (`) to let us see whatever tags you are trying to write. Edit your post so we can help!
hi plz anybody can help. I’m still fighting with the problem…
On your code you set the twitter button inside the on click function for your new quote. I can post the loaded quote without p tags on a twitter, but if I click to get a new quote and then try to post that new quote to twitter, it opens a blank page.
You should set a on click method separated from your on click new quote. So when clikcing twitter you need to grab the innerHTML of the actual quote displayed and send it along with your twitter link. The innerHTML will not give you p tags.
your suggestion helped me to finish this challenge. I kept the twitter link inside the onclick but changed the code to retreive the quote using innerHTML of actual displayed quote.
thanx again for the suggestion. here is the link to my final submition.