John Davidson

javascript - Redirect to Page based on Input Value

0 comments
Message:


I am attempting to create a form on the page that requires the user to input text. Once the form is submitted, the user will then be redirected to the page assigned to it. My question is where am I going wrong and how should I resolve this issue? Could someone include a JSFiddle or Codepen.io pen for deminstration purposes?



For example:




  1. User enters and submits "123456"

  2. User is then redirected to the page www.domain.com/123456



I am assuming it is something like this:



HTML



<form>
<input id="projectid" maxlength="6">
<input onclick="findProject()" type="submit" value="Go">
</form>


Javascript



function findProject(){
document.location = document.getElementById('projectId').value();
}


I have included my own pen: http://codepen.io/ShaneHicks/pen/eZbbLz



My Answer:





Redirect Form









Rate this post

3 of 5 based on 5634 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us