Why jQuery has no :readonly selector?
There are :checked and :selected and :disabled selectors for inputs. So, why there is no :readonly selector? I mean, as a “coding sugar”.
Because all these square brackets are ugly — “.is(‘[readonly]’)”. Why no “.is(‘:readonly’)”?
Maybe there is some reason why :readonly selector doesn’t exist?
This enhancement was denied in: http://bugs.jquery.com/ticket/2497
Reason given:
To see for yourself:
You could use
:read-only, though I’m not sure of the support:http://jsfiddle.net/YGuNG/
Works in chrome but not in firefox.