Hi Guys,

I'm trying to build a very simple script that takes the value from a text box and places it within a link (as a parameter) then execute the link afterwards.

So the link would basically look like this

And the value from the text will be placed where {{insert}} is.

And a value from a text box :

<input type="text" name="tube" id="linkText">
So far I have got this:




var link = document.getElementById('linkid'),
  textBox = document.getElementById('textInputId');
function setLinkParam() {
  link.href = 'http://request.com/action.jsp?parameter=' + textBox.value;
textBox.addEventListener('change', setLinkParam);




<input type="text" id="textInputId"></input>
<a href="http://event.com/action.jsp?param=" id=""linkid">Link</a>
 <input type="submit" value="Submit" action"setLinkParam()">


But I'm not sure what bit I have wrong, can someone point me in the right direction and tell me why it doesn't (this is a learning exercise).