I am trying tot get my javascript code to redirect to the Index.html page if the variable money is equal to 100. Here is the html form code:
<form id = "form" action = "">
<h1> Enter the amount of money you would like to spend on your next trip. </h1><br>
<div class="input-group">
<span class="input-group-addon">$</span>
<input type="text" name="money" class="form-control">
</div>
<br>
<button type="submit" class="btn btn-default" onclick = "MoneyForTrip()">Show Trips</button>
</form>
and the javascript:
var money;
function MoneyForTrip()
{
money = parseInt(
document.getElementById('form').money.value);
if (money == 100)
{
window.location="Index.html";
}
else
{
window.alert("Enter another number");
}
}
Any idea how I can get it to redirect to Index.html if money is equal to 100?