Question: Take a look at this fiddle: <http://jsfiddle.net/8HHvf/>  

HTML

```
<ul id='myUL'>
    <li id="a"></li>
    <li id="b"></li>
    <li id="c"></li>
    <li id="d"></li>
    <li id="e"></li>
</ul>

```

JS

```
var arr = [];
$a=$('#a');
arr.push($a);
$a=$('#b');
arr.push($a);
$a=$('#d');
arr.push($a);
$a=$('#e');
arr.push($a);

console.log(arr);
if(jQuery.inArray($('li#b'),arr)!=-1){
    console.log('aurica!!!');
}

```

I am populating an array with jQuery objects but the inArray method does not find an object.  

This code suppose to write "aurica!!!" but it doesn't.

do you have any idea why, and more impotent how can I find a jQuery object inside an array???

Answer: 
By reassigning $a, you're just writing $('#e') to your array four times. You can see this if you:

```
console.log(JSON.stringify(arr))

```

in a modern browser.
By pushing the return value of the selector, you are creating a new array and storing it into your array variable. To be able to compare it at a late point of time, you should actually be storing the element itself of anything from it that is (uniquely) comparable. 

Below changes to your JS should do the trick,

```
$(function() {
var arr = [];
$a=$('#a');
arr.push($a[0]);
$a=$('#b');
arr.push($a[0]);
$a=$('#d');
arr.push($a[0]);
$a=$('#e');
arr.push($a[0]);

console.log(arr);
if(jQuery.inArray($('li#a')[0],arr)!=-1){
    console.log('aurica!!!');
}
arr = jQuery.grep(arr, function(value) {
  return !$('#b').is(value);;
});
console.log(arr);

//alert(y);
});

```