<div id="a">
<div id="b"></div>
<div id="c"></div>
</div>
When we say that exists, we want to choose the rest except for the sub-elements of a and a elements.
$("#a, #a *").on("click", function(){
});
Is there a way to not only the selector part here?
jquery
// Select all under the reference container object, then select → only those that do not correspond to '#a' or '#a *'.
$('#container *').not("#a, #a *").on('click', function(ev) {
alert(ev.target.innerText);
});
© 2024 OneMinuteCode. All rights reserved.