James in Indy
James in Indy

Reputation: 2884

jQuery Select all TextBoxes within one element but not another

This one shouldn't be too hard...

I have a DIV named X, which contains child DIV's A, B, and C (no those aren't the real names). The following jQuery properly selects all textboxes from within DIV X and its children:

var theFields = $("input:text", $("div[id$='X']"));

However, DIV C is an exception and should be skipped. How do I select all textboxes within DIV X and its children, but skip those in child DIV C? I've used the :NOT operator before, but I'm not sure how to use it here.

Thanks.

Upvotes: 0

Views: 1142

Answers (1)

Weetu
Weetu

Reputation: 1773

$('div#X input:not(div#C > input)')

Upvotes: 1

Related Questions