"tabindex" selector: IE6 Vs FF3.6
Currently our company is migrating from IE6 to FireFox 3.6. For some time both browser will be used in parallel.
The selector $("[tabindex]") seems to act differently on both browsers, consider the following code:
- <script type="text/javascript">
- $(document).ready(function() {
- var output = "";
- $("[tabindex]").each(function(i, elem) {
- output += "<br/>";
- output += $(elem).attr("text") + ":" + $(elem).attr("tabindex");
- });
- $("#result").html(output);
- });
- </script>
- <form>
- Text <input tabindex="1" text="Text" type="text">
- Check <input tabindex="2" text="Check" type="checkbox">
- <input tabindex="3" text="Login" type="button" value="Login">
- <br/>
- _Text <input text="_Text" type="text">
- _Check <input text="_Check" type="checkbox">
- <input text="_Login" type="button" value="Login">
- <p id="result">
- </form>
The result on FireFox is, as espected, a list of element text and tabindex:
Text:1 Check:2 Login:3
On IE6, the selector seems to take all elements, and the result is:
undefined:undefined undefined:undefined :undefined :undefined :undefined $(document).ready(function() { var output = ""; $("[tabindex]").each(function(i, elem) { output += " "; output += $(elem).attr("text") + ":" + $(elem).attr("tabindex"); }); $("#result").html(output); }); :undefined undefined:0 Text:1 Check:2 Login:3 undefined:undefined _Text:0 _Check:0 _Login:0 undefined:undefined Any idea how can I select in IE6 only elements with a defined tabindex attribute ?