I am looking for a generalised selector function that does the following:
$(".data").click(function(){
//insert proper selector
)};
<div class="one">
<div class="data">text</div>
<div class="data">text</div>
<div class="data">text</div>
</div>
<div class="two">
<div class="data">text</div>
<div class="data">text</div>
<div class="data">text</div>
</div>
I want the selector to do the following:
1). Select all divs within the parent div (which means including the one you just clicked).
2). Do NOT select the divs within the other "parent" div.
I also realised that it would be cool if you could filter $(this) (the div you clicked) from the selected items. Consider that a bonus question :)
I've been looking at this from different angles but only found ugly hard coded (to a specific parent). I appreciate any input!