77

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

5 Answers 5

152

This should work:

$(":input:not([readonly])")
0
39
$('input:not([readonly])')

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

4

I recently did something similar like this:

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

I suppose you are looking for something like the following:

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

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

0

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.