In the structure of my webpage, there are two main DIV elements labeled as #div1 and #div2. Each of these parent DIVs has child DIV elements within them. I am looking to use jQuery to select all of these child DIVs from both parents simultaneously.
<div id="div1">
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<div id="div2">
<div></div>
<div></div>
</div>
Can I utilize $("(#div1, #div2) > div")
for this selection?
Although I could also use
$("#div1 > div, #div2 > div")
to achieve the same result, it can become cumbersome if the selector "> div" becomes more complex or if there are multiple parent elements involved, making the expression hard to read.