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; "> </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
精彩评论