I am having a problem with the tweet button on my random quote generator. When I click the button the text in the tweet box says undefinedudefned. I’m pretty sure I missed something important but I’m not sure what it is. Please help me. Here is my page http://codepen.io/johnwm211/pen/NAvEJj
Your code:
window.open('http://twitter.com/intent/tweet?text=' + ('#quote').text + ('#author').text);
You forgot $
before (#quote)
and (#author)
. Then add ()
after .text
.
Adding a space between the quote and author doesn’t hurt.
1 Like
Worked perfectly thanks a lot. I figured I was overlooking something simple.