JS defines methods for web form submission (submit)
- 2020-05-17 04:50:44
- OfStack
This example demonstrates how JS defines web form submission (submit). Share with you for your reference. The details are as follows:
This code indicates that instead of submitting the web form to the specified page, a specific function is executed
<script>
function saveInfo() {
localStorage.setItem("name",$("#name").val());
}
</script>
<form id=register onSubmit="return saveInfo()">
<label for="name">Name:</label>
<input type=text name=name id=name>
<input type=submit value=save>
</form>
I hope this article is helpful for you to design javascript program.