Using a jQuery selector, is it possible to select all elements that are not a descendant of the elements from another selector.
For example, I would like to select all the a
tags that are not a descendant of a th
tag. The only way I can see to do it right now is as follows:
$('a').filter(function () {
return $(this).closest('th').size() == 0
})
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…