Select all but not disabled

0 views
Skip to first unread message

Andrew Poulos

unread,
May 1, 2021, 10:02:19 PM5/1/21
to
I have a "complex" form with different types elements.

How do I do a selector that selects:
- all inputs that are not buttons,
- selects
- text areas
- check boxes
- radio buttons
- some images
BUT
- nothing that is disabled
?

So far I have
input:not([type="button"]), input.preview, textarea, select
but I get stuck on excluding disabled elements.

Andrew Poulos

James Kirk

unread,
May 1, 2021, 11:05:20 PM5/1/21
to
In Message: <gPCdnTeNodq4lRP9...@westnet.com.au>
The same way you did the attribute type … :not([disabled])


--
J𝕒𝕞𝕖𝕤 𝕂𝕚𝕣𝕜


Andrew Poulos

unread,
May 2, 2021, 2:59:20 AM5/2/21
to
Should I add :not([disabled]) to all of the attributes in the selector?

Andrew Poulos

James Kirk

unread,
May 2, 2021, 8:00:43 AM5/2/21
to
In Message: <7PKdnXVVrOZc0BP9...@westnet.com.au>
You should add it to each of the selectors.

:not([disabled]) would be the same as *:not([disabled])

input:not([type="button"]):not([disabled]),
input.preview:not([disabled]), textarea:not([disabled]),
select:not([disabled])…

you should not need the input.preview:not([disabled]), unless it is
type=button, since input:not([type="button"]):not([disabled]) should
include it.

--
J𝕒𝕞𝕖𝕤 𝕂𝕚𝕣𝕜


Reply all
Reply to author
Forward
0 new messages