Home > Software engineering >  How to open URL that is inside of textbox
How to open URL that is inside of textbox

Time:04-09

So I have tried this one: <input type="url" id="textbox" /> <input type="button" id="btn" value="Submit" onClick="javascript: window.location = document.getElementById('textbox').value; /> What I tried to do was that my site would have a text area where I can write a URL and then once you've pressed "Submit" would go to that site without opening a new window or tab. What mistake I have made?

CodePudding user response:

<input type="url" id="textbox" /> <input type="button" id="btn" value="Submit" onClick="window.location = document.getElementById('textbox').value;" />

  • Related