Click here to Skip to main content
15,914,642 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have this on a website
<input type="button" />
<input type="form" id="form" />
<script>
var form = document.getElementById('form');
function redirect()
{
location.href = "https://youtube.com/form";
}
</script>

After https://youtube.com/ how do i get it to show what you put in the form?
Posted

1 solution

location.href = "https://youtube.com/"+form.value;

Also you need to execute function on click event

<button onclick="redirect()">Redirect</button>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900