开发者

Weird IE behaviour getting index values jQuery

开发者 https://www.devze.com 2023-02-09 12:45 出处:网络
I\'ve got this mousedown function, to get the index value of its parent: div.combo_list, in Chrome and Firefox I get the good values that are zero based, like 0, 1, 2, 4...

I've got this mousedown function, to get the index value of its parent: div.combo_list, in Chrome and Firefox I get the good values that are zero based, like 0, 1, 2, 4...

The strange thing is that IE8 gives me: 1, 3, 4...

Does anybody know about or recognize this behaviour?

<div class="combo_list " style="width: 143px; display: none; ">
<div style="width: 100%; overflow-x: hidden; overflow-y: hidden; ">&nbsp;</div>
<div style="width: 100%; overflow-x: hidden; ov开发者_JS百科erflow-y: hidden; ">ex 1</div>
<div style="width: 100%; overflow-x: hidden; overflow-y: hidden; ">ex 2</div>
<div style="width: 100%; overflow-x: hidden; overflow-y: hidden; ">ex 3</div>
</div>


$("div.combo_list div").live("mousedown", function(){
            var nodeIndex = $(this).parent().index(); 
            alert ("" + nodeIndex); 
});  


I would take a look at this bug reported for jQuery here. It seems that IE might be attempting to add a new node into your HTML document. Try and run your site through an HTML validator

0

精彩评论

暂无评论...
验证码 换一张
取 消