JSFiddle - React, Tailwind, and code Playground

by wisegorilla

HTML

<!DOCTYPE html>
<html>
<body>

<h2 class='test'>HTML Forms</h2>

<form action="/action_page.php" class="wpcf7-form">
  First name:<br>
  <input type="text" name="firstname" value="Mickey" class='test'>
  <br>
  Last name:<br>
  <input type="text" name="lastname" value="Mouse" required>
  <br><br>
  <input type="submit" value="Submit">
</form> 

<p>If you click the "Submit" button, the form-data will be sent to a page called "/action_page.php".</p>

</body>
</html>

JavaScript

window.onload = function() {
    var form = document.querySelector("form");
    form.onsubmit = submitted.bind(form);
}

function submitted(event) {
    event.preventDefault();
}