Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undisable certain elements inside disabled fieldset

Is there a way (like an attribute on an element) to 'undisable' a specific element when the parent fieldset is disabled? Preferable without any JavaScript. If not, what is a good practice to disable an entire form with specific exceptions?

<fieldset disabled>
  Name: <input type="text"><br>

  <!-- Email shouldn't be disabled -->
  Email: <input type="text"><br>

  <!-- more fields ... -->
</fieldset>
like image 928
Thijs Avatar asked Feb 04 '16 09:02

Thijs


Video Answer


1 Answers

Put your input inside the <legend> element:

<fieldset disabled>
  <legend>
    <label>Email: <input></label>
  </legend>

  <label>Name: <input></label>
  <!-- more fields ... -->
</fieldset>
like image 148
Rúnar Berg Avatar answered Nov 08 '22 19:11

Rúnar Berg