compile-fan
compile-fan

Reputation: 17615

How to find non-disabled elements in a form with jQuery?

I'm now doing it this way:

$form.find(':input')

But how do exclude those disabled elements?

Upvotes: 3

Views: 1006

Answers (3)

Terry Kernan
Terry Kernan

Reputation: 806

I thought it might be useful to post a simple variation here, taking a cue from the code snippet above. I wanted to find if a particular element was enabled:

var firstNameEnabled = $('.firstName:input:enabled').length > 0;

Now firstNameEnabled will be true false, depending on the state the field has

Upvotes: 0

Simasher
Simasher

Reputation: 117

You may want to use

$(':input:enabled',$('#FormID'));

or

$('#FormID :input:enabled')

Upvotes: 0

BoltClock
BoltClock

Reputation: 723578

Use :enabled

$form.find(':input:enabled')

Upvotes: 7

Related Questions