Randomblue
Randomblue

Reputation: 116273

jQuery selector for next unfocused input

I have an input element $myInput = $('#someInput') within a paragraph. I would like to find the next input element in that paragraph which is unfocused.

I have tried $myInput.next('input(:not(:focus))') but this doesn't seem to work.

Upvotes: 1

Views: 672

Answers (2)

Scott Greenfield
Scott Greenfield

Reputation: 2828

$myInput.nextAll('input').not(':focus').first();

Upvotes: 2

jondavidjohn
jondavidjohn

Reputation: 62392

$myInput = $('input');

and then

$myInput.nextAll('input').not(':focus').eq(0);

Upvotes: 3

Related Questions