Using JavaScript, I am trying to set up a page redirect based on user input from a text box. When I fill out the text box, each if
condition is met but the page is not redirecting.
<script type="text/javascript">
function validateTextBox() {
var box = document.getElementById("width")
var box2 = document.getElementById("height")
var box3 = document.getElementById("length")
if (box.value < 25 && box2.value < 25 && box3.value < 25) {
window.location.href = "jointext.html";
}
}
</script>
</head>
<body>
<form id="theform" action="" method="post" onsubmit="validateTextBox()">
<h3> What do I need </h3>
<div class="row">
<label for ="width"> Width Of Room in Metres </label> <br>
<input type="text" id="width" name=""> <br><br>
</div>
I have no idea why am I on the right lines?
I am fairly new in my learning so any advice would be great. Is this the way to go about this and if so what have I done wrong. Thanks all
What do I need