Disable all inputs in form

by mmyoji

1 min read

When you want to disable all inputs in form after submitting, you can use fieldset for the purpose.

<form action="#">
  <fieldset disabled><!-- like this -->
    <legend>Sign in</legend>

    <label for="email">Email</label>
    <input id="email" name="email" type="email">

    <label for="password">Password</label>
    <input id="password" name="password" type="password">

    <input type="submit">
    <!-- button is also disabled
      <button>Submit</button>
    -->
  </fieldset>
</form>

see:

: The Field Set element - HTML: HyperText Markup Language | MDN