I have 2 elements ( div ) :
I
<div id="1">
<div >
<img /> <img />
<span> </span>
.
.
<div>
<div>
<p></p>
.
.
</div>
.
.
</div>
II
<div id="2">
<div >
<img />
<span></span>
<h1></h1>
.
.
<div>
.
.
</div>
both divs have different number of child and those child further have different number of there subchilds. My question is , i want to compare these 2 div and access all the unsimilar elements present in div#2 in comparison with div#1. How can i do this with using jquery methods and as efficient as possible?
this can be a good start for you:
you go over each element and look for a match. push all the elements that have no match in array and return the array.
note that it compare the first children of each given object.
to call it: