If I have this HTML:
<input type="button" />
<input type="button" />
<input class="btn" type="button" />
<div class="btn"></div>
<div class="btn"></div>
I have 3 buttons in a jQuery object.. say var buttons = $(':button');.
Then I have another object that has a different 3 set of elements, ONE of them, being the same: var nextButtons = $('.btn');
Is there a jQuery way of checking if all the elements are the same? is() seems to return true if any of the elements match.
EDIT:
I mean a comparison in the exact same way that is() works. I’d guess, this function would call is() for each element in the first set, for each of the second set.
There’s nothing built-in, but it’s really easy to do:
See it in action.