I should think that this should be done with empty text nodes, Firefox will not register a space between the words "<span> tag and input tag", where IE will be, so for FF the second node will be the <input> (<span> <input tag >), where it will be the text node (<span> - empty text node - <input>).
EDIT:
After some testing (the previous answer was just a normal problem that I ran into, so I suggested that this might be the same for you). The problem is that IE takes your closing tag as an element in dom.
If you change the code to short circuit tags, that is:
<div>
<span>
<input type = "checkbox" />
<span> Fake Initiative A </span> <span> 1 </span>
</span>
<span>
<input type = "checkbox" />
<span> Initiative B Not Real </span> <span> 2 </span>
</span>
</div>
Then it should work as predicted.
Just for reference, my entire test script (for text alert only):
<! DOCTYPE HTML PUBLIC "- // W3C // DTD HTML 3.2 Final // EN">
<html>
<head>
<title> Title here! </title>
<script type = "text / Javascript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"> </script>
<script type = "text / Javascript">
$ (function () {
$ ("input: checkbox"). bind ('click', function () {
alert ($ (this) .parent (). children (). eq (2) .text ());
});
});
</script>
</head>
<body>
<div>
<span>
<input type = "checkbox" />
<span> Fake Initiative A </span> <span> 1 </span>
</span>
<span>
<input type = "checkbox" />
<span> Initiative B Not Real </span> <span> 2 </span> </span>
</div>
</body>
</html>
source share