关于jquery的index方法

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



属性选择器 $(function(){ $("#doit").click(function(){ alert($("div").index($('.test'))[0]); }); });



demo1
test1
test3


test1
test1
test1
test1
test1



为什么在我点击press按钮时,弹出框显示为:undefined,哪位高手能赐教?

[0]位置问题:
[quote]alert($("div").index($('.test'))[0]); [/quote]
改成
[code="java"]alert($("div").index($('.test')[0]));[/code]