I am trying to build a tweet button into my UX component with a dynamic message. Have very limited experience in html and javascript and hoping someone can advise. I want to dynamically control the anchor tag by building it to contain a desired message, in this case a match score at the time
Please see this video clip showing the current behaviour. https://youtu.be/9UVb2IgTcU0
Where the message reads ?Score Update? I would like to dynamically populate the values on the competing teams and the score e.g. Hamiltons vs Malmesbury Rugby Club - 50:0
The tweet button is in an HTML free-form container.
freeform container.jpg
The html container contains a table and below the </table> tag is the code for the tweet button. (button code from twitter website - https://dev.twitter.com/web/tweet-button/parameters
How can I dynamically change the anchor tag with my message. In other words change red part <a href="https://twitter.com/intent/tweet?button_hashtag=scrumIT_wp&text=Score%20Update%20" to Club A vs Club B - 10:0
Please see this video clip showing the current behaviour. https://youtu.be/9UVb2IgTcU0
Where the message reads ?Score Update? I would like to dynamically populate the values on the competing teams and the score e.g. Hamiltons vs Malmesbury Rugby Club - 50:0
The tweet button is in an HTML free-form container.
freeform container.jpg
The html container contains a table and below the </table> tag is the code for the tweet button. (button code from twitter website - https://dev.twitter.com/web/tweet-button/parameters
HTML Code:
<table align="center" border="0" cellpadding="1" cellspacing="1" style="width: 100%;"> <thead> <tr> <th scope="col" align="center" width="60%"> </th> <th scope="col" align="center" width="20%">Score</th> <th scope="col" align="center" width="20%">Log Points</th> </tr> </thead> <tbody> <tr> <td>{HomeClubName}</td> <td align="center">{HomePoints}</td> <td align="center">{LogPointsHome}</td> </tr> <tr> <td>{AwayClubName}</td> <td align="center">{AwayPoints}</td> <td align="center">{LogPointsAway}</td> </tr> </tbody> </table> <a href="https://twitter.com/intent/tweet?button_hashtag=scrumIT_wp&text=Score%20Update%20"; target="_top" class="twitter-hashtag-button" data-size="large" data-related="scrumITsa">Tweet #scrumIT_wp</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
Comment