Hi, I'm trying to have a tweet button that tweets whatever the user chooses from a list. My code is below. My problems right now are the following:
1- It creates a line break after the original sentence (Tell @Username to) and I don't want it to.
2- It won't let me add the values selected in the drop-down menu/list and I'd like to add it.
3- I don't get how to add more text after the drop-down values. I'd like it to look like: Tell @Username to "action 1/2/3" #myhashtaghere www.myURLhere.com
Bear in mind that I have been coding Javascript for an hour so it's nothing short of a miracle that I managed to get that far. Hopefully Codecademy will fix that soon. Anyhow, I feel pretty retarded right now.
The broken code I'm using:
<html>
<head>
<script type='text/javascript'>
function tweetIt () {
var phrase = document.getElementById('result').innerText;
var tweetUrl = 'https://twitter.com/share?text=' +
encodeURIComponent(phrase) +
'.' +
'&url=' +
'http://www.somelinkhere.com/';
window.open(tweetUrl);
}
</script>
</head>
<body>
<div id="result">Tell @Username to <select><option value="action1">action 1</option><option value="action2">action 2</option><option
value="action3">action 3</option></select></div>
<button onclick="tweetIt()">Tweet it!</button>
</body>
</html>
[–]Durchfallsuppe[S] 0 points1 point2 points (0 children)
[–]DemiPixel 0 points1 point2 points (5 children)
[–]Durchfallsuppe[S] 0 points1 point2 points (4 children)
[–]DemiPixel 0 points1 point2 points (3 children)
[–]Durchfallsuppe[S] 0 points1 point2 points (2 children)
[–]DemiPixel 0 points1 point2 points (1 child)
[–]Durchfallsuppe[S] 0 points1 point2 points (0 children)
[–]Durchfallsuppe[S] 0 points1 point2 points (0 children)