Can't get twitter button to open new window

Hi,

This project is definitely challenging! Been muddling my way through it (apologies for repeating myself in the JavaScript, will fix that at some point). I am almost done with the functionality, but can’t get the twitter button to open a new window. Any pointers?

Hi,

the problem was that the button had no link.

I have added the link to the button and configured via jQuery and it works ok :slight_smile:

You must remove this first

$('document').on('click','#tweetbutton',function(){
   window.open("about.blank");
});

Button Update (see the new a tag):-

 <div id = "tweet">
     <button id="tweetbutton" type="button"><a id="tweetme">Tweet this quote!</a></button> 
 </div> 

Button Jquery:- this works by adding the href attribute to the buttons new a tag each time your new quote btutton is clicked. the target blank is the new window. the new jquery replaces the on.click function and must go like so:–

place the new jquery directly under this line and before the }); so it sits inside your quotebutton function.

$('#authordiv').append('<p id="author"> - ' + authors[y] + '</p>');

New Jquery

//configure tweet button with quote and author info
$('#tweetme').attr('href', 'https://twitter.com/intent/tweet?hashtags=quotes&text=' + '"' + quotes[y] + '"' + '  ~' + authors[y]);
$('#tweetme').attr('target', '_blank');

Hope this helps

Mark

You can update code as following :

<div id = "tweet">
<a target="_blank" title="" href="https://www.twitter.com">
<button id="tweetbutton"  type="button">Tweet this quote!</button></a>
</div>

This will only help to open new window.

Hope this helps !!!