How to select elements that can accept text as an input as well as elements that support only text display?
Select elements accepting text input or displaying only text
35 views Asked by CyberAP At
1
How to select elements that can accept text as an input as well as elements that support only text display?
You can do this with a
:read-write
pseudo-class.Browser text case.
:read-write
will select any element that can accept text input;:read-only
, due to poor support in Safari and Firefox. Instead, use a basic attribute selector. (readonly
attribute is supported only on text-accepting inputs);textarea
with a:read-only
as well, but it's simpler to just writetextarea
;date
andtime
input types with:read-write
, so we have to select them explicitly.