How do I determine if two jQuery objects are equal? I would like to be able to search an array for a particular jQuery object.
$.inArray(jqobj, my_array);//-
It is, generally speaking, a bad idea to compare $(foo) with $(foo) as that is functionally equivalent to the following comparison:
Of course you would never expect "JS engine screw-up". I use "$" just to make it clear what jQuery is doing.
Whenever you call $("#foo") you are actually doing a jQuery("#foo") which returns a new object. So comparing them and expecting same object is not correct.
However what you CAN do may be is something like:
So really you should perhaps compare the ID elements of the jQuery objects in your real program so something like
...
$(someIdSelector).attr("id") == $(someOtherIdSelector).attr("id")
is more appropriate.