Override fieldset disabled attribute

Viewed 322

I have a complex form with many <input> elements, most of which I need to disable conditionally (via AngularJS to precise, but this question primarily targets the HTML aspect).

In order to avoid having to set a disabled attribute on every element, I place my inputs into a <fieldset> and set the disabled attribute once. This disables all contained inputs fields.

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

<head>
  <meta charset="utf-8">
  <title>Fieldsets</title>
</head>

<body>
  <form>
    <fieldset disabled="true">

      <input type="text" placeholder="first">
      <input type="text" placeholder="second">

      <!-- many, many more -->

      <!-- trying to override here -->
      <input type="text" placeholder="last" disabled="false">

    </fieldset>
  </form>
</body>

</html>

Now I need to make a few exceptions and keep some inputs enabled even though the surrounding <fieldset> is disabled. I tried overriding the attribute there by setting disabled="false", but this does not work.

Is there any elegant way to override the disabled attribute?

0 Answers
Related