You've got the parameters backwards. The element to look for should come first, followed by the array.
Here's the code (from 1.5.0):
inArray: function( elem, array ) {
if ( array.indexOf ) {
return array.indexOf( elem );
}
for ( var i = 0, length = array.length; i < length; i++ ) {
if ( array[ i ] === elem ) {
return i;
}
}
return -1;
},
Now an interesting question is why the string ".indexOf()" returns 0 in IE7 when you pass in an empty array as the target. Somebody might know, but I try pretty hard not to worry about why the broken parts of IE7 are the way they are.
edit — interesting update: it turns out that though the above code is definitely there in the jQuery source, it's later redefined. The above definition is at line 691 in the 1.4.4 source, but then later, at line 855, we see:
if ( indexOf ) {
jQuery.inArray = function( elem, array ) {
return indexOf.call( array, elem );
};
}
There, the naked variable "indexOf" is a stashed reference to "Array.prototype.indexOf". When that's called with ".call()", with a string as the first parameter and an empty array as the second, you get -1 back.