jQuery "not readonly" selector

JqueryJquery Selectors

Jquery Problem Overview


I'm looking for something along the lines of...

$(':input:not(readonly)') // all inputs which are not readonly

but struggling to find the syntax.

Any pointers? thanks

Jquery Solutions


Solution 1 - Jquery

This should work:

$(":input:not([readonly])")

Solution 2 - Jquery

$('input:not([readonly])')

would cover readonly, readonly="true" and readonly="readonly"

Solution 3 - Jquery

I recently did something similar like this:

$('#element').find(':input').not(':input[readonly]');

Solution 4 - Jquery

I suppose you are looking for something like the following:

$('input:not([readonly="readonly"])')

Have a look at jQuery's various attribute-selectors.

Solution 5 - Jquery

I would like to add another answer that works for me, using context https://api.jquery.com/context/

$(this).context.readOnly == false / true

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionfearofawhackplanetView Question on Stackoverflow
Solution 1 - JqueryhalfdanView Answer on Stackoverflow
Solution 2 - JqueryAdrian GarnerView Answer on Stackoverflow
Solution 3 - JquerySphygmomanometerView Answer on Stackoverflow
Solution 4 - JqueryjwuellerView Answer on Stackoverflow
Solution 5 - JqueryFlorinView Answer on Stackoverflow