find()
This works very similar to children(), only it looks at both children and
more distant descendants. It is also often a safer bet than children().
Say it’s your last day on a project. You need to write some code to hide all
from their table mark-up, so we need to cover all bases for the future. It
would be risky to target the
1 $('#table tbody tr.hideMe').hide();
... because that would fail if there’s no
1 $('#table').find('tr.hideMe').hide();
This says that wherever you find a
whatever descendancy, hide it.
6. .not() vs. !.is() vs. :not()
As you’d expect from functions named “not” and “is,” these are opposites.
But there’s more to it than that, and these two are not really equivalents.
.not()
not() returns elements that do not match its selector. For example:
1 $('p').not('.someclass').css('color', '#f90');
That turns all paragraphs that do not have the class someclass orange.