Here's the issue: I have a div with multiple siblings positioned before and after it. For example:
<div id="parent">
<div class="invalid"></div><!-- break iteration here !-->
<div class="operand"></div>
<div class="constant"></div>
<div class="operator"></div>
<div class="operand"></div><!--this is the target div i want its siblings !-->
<div class="constant"></div>
<div class="constant"></div>
<div class="operator"></div>
<div class="invalid"></div><!-- break iteration here !-->
</div>
I am trying to iterate through all siblings of class "constant" or class "operator," including both next and previous siblings, until reaching the first mismatch in either direction.
What I've attempted so far:
.next(".constant", ".operator").appendTo("#mydiv")
.prev(".constant", ".operator").appendTo("#mydiv")
The problem lies in extending beyond the next siblings and halting at the first mismatch.