Answers for "button on click submit form in html"

2

form with a submit button

<form action="/action_page.php">
  <label for="fname">First 
  name:</label><br>
  <input type="text" id="fname" name="fname" 
  value="John"><br>
  <label for="lname">Last name:</label><br>
  
  <input type="text" id="lname" name="lname" value="Doe"><br><br>
  
  <input type="submit" value="Submit">
</form>
Posted by: Guest on June-29-2021
0

html submit form onclick

var form = document.getElementById("form-id");

document.getElementById("your-id").addEventListener("click", function () {
  form.submit();
});
Posted by: Guest on July-08-2020

Code answers related to "button on click submit form in html"

Browse Popular Code Answers by Language