JSFiddle - React, Tailwind, and code Playground

by techiedelight

HTML

<!doctype html>
<html lang="en">

  <body>
    <form onsubmit="document.getElementById('submit').disabled=true; processFormData();">
      <p>Choose your preferred contact method:</p>
      <div>
        <input type="radio" id="email" name="contact" value="email">
        <label for="email">Email</label>

        <input type="radio" id="phone" name="contact" value="phone">
        <label for="phone">Phone</label>
      </div>
      <div>
        <button id="submit" type="submit">Submit</button>
      </div>
    </form>
  </body>

</html>

CSS

button {
  font-size: 14px;
  margin: 15px;
  padding: 0 15px;
}

JavaScript

processFormData = function() {
   console.log('Submitting form..');
   // For this example, don't actually submit the form
   event.preventDefault();
};