I've a Javascript array and pushing the elements for later usage like this:
var array = [jQuery('.first').eq(0)];
Now if I try to check if the same element in array exists, it returns -1
jQuery.inArray(jQuery('.first').eq(0), array)
What is the perfect way to find if the object exists in array or not.
inArray()into making a special case for jQuery objects. Therefore, you'll have to write a custom loop. Of course, you can wrap that loop in a function if you're so inclined.