I'm trying to make an HTML document that has a form inside. After completing the form (which was to input the name of a website like google.com, the JS script should redirect you). the website reloaded itself. Is there a simple function that can do this?
<html>
<body>
<p>Enter Website link in the field, then click "Submit" to submit the form:</p>
<form id="frm1" action="">
Website Link: <input type="text" name="webl"><br>
<input type="button" onclick="myFunction()" value="Submit">
</form>
<script>
function myFunction() {
document.getElementById("frm1").submit();
}
</script>
</body>
</html>
After running the script and submitting the link, the same website appeared. By the way guys, I am just getting started with JavaScript, so I could likely have made a simple mistake. Thanks.