Reputation: 11308
Given the following HTML,
<div class="a">
<div class="b"></div>
<div class="c"></div>
<div class="d"></div>
</div>
How would I write an .on event selector that will fire for b and c, but not d?
I've tried:
$(document).on("click", ".a .b.c", function () {
alert('test');
});
but this doesn't seem to work.
Upvotes: 0
Views: 71
Reputation: 5519
If you want to specifically target .b
and .c
under .a
:
$(document).on("click", ".a .b, .a .c", function () {
alert('test');
});
Upvotes: 5