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
42 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-writepseudo-class.Browser text case.
:read-writewill select any element that can accept text input;:read-only, due to poor support in Safari and Firefox. Instead, use a basic attribute selector. (readonlyattribute is supported only on text-accepting inputs);textareawith a:read-onlyas well, but it's simpler to just writetextarea;dateandtimeinput types with:read-write, so we have to select them explicitly.