Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery selector not() with children of selected elements

Basically adding some slider features, and would like to throw the slider under the error CSS class to highlight under certain conditions.

I am programming tooltips to slide along above the handles, and when the error style is added, i want to throw it across all elements, except these handles. The handles are encapsulated in their own <div class="tooltip"> tags, however, when I call the selector to call var div = $(this).find('div:not([class=.tooltip])');, the child elements of this encapsulating div class have their styles updated when i subsequently call div.addClass("ui-state-error ");

TL;DR: Is there any way to call the not() selector such that an element, and all its children, are excluded. I know that explicitly listing the child elements is a quick dirty workaround, but is there anything in the JQuery library to accommodate this?

Note that I am purposely avoiding ID tags as this control will eventually make it into an ASP User Control, and I want to avoid conflicting ID tags later on down the line.

like image 284
Daniel Park Avatar asked Dec 20 '22 00:12

Daniel Park


1 Answers

Try this :

$(this).find('div:not(.tooltip, .tooltip *)');
like image 164
Karl-André Gagnon Avatar answered Dec 29 '22 11:12

Karl-André Gagnon