My page is reloaded after I press the enter key, and I don't want that to happen. I am not using jQuery. I saw in other places that if I typed return false
in my onSubmit
, then it will not reload. This did not work for me.
<form onsubmit="save(); return false" id="form">
Type Here: <input type="text" id="inInput">
</form>
This is the save()
function. It is in my javascript.
function save()
{
savedVar = document.getElementById("inInput").value;
document.getElementById("myDiv").style.display = "block";
document.getElementById("printer").innerHTML = savedVar;
clearInput();
if (curOp == "v")
{
vowelDo();
}
else if (curOp == "t")
{
translaterDo();
}
}