javascript - Use input from textfield to create an URL -
since @anywhere no longer supported, i'm looking nice way let people send tweets directly page without twitter widget.
it possible create url fills in text tweet:
https://twitter.com/intent/tweet?text=hello+this+is+a+test+message
is there way make input field , let filled in text converted text+text+text format. submitting filled in text link type of url mentioned above.
so if type in words: 'i love guys!' submitting result in linking to: https://twitter.com/intent/tweet?text=i+love+you+guys!
sure!
<input type="text" name="msg" /><button>tweet!</button> <script> document.queryselector('button').addeventlistener('click', function() { var msg = document.queryselector('input[name=msg]').value.replace(/ /g, '+'); location.href = 'https://twitter.com/tweet.php?text=' + msg; }); </script>