jquery(elem).parents('form') returns unexpected nodes IE 6 & 8
<script type="text/javascript"
src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<form><input type="submit"/></form>
<form><input type="submit"/></form>
<form><input type="submit"/></form>
<script type="text/javascript">
$('input:submit').click(function(){
alert($(this).parents('form').length);return false;
});
</script>
The 2nd & 3rd button will alert "2" when it was clicked.
The 1st will always be contained in the parents() returned value, WHY?
It doesn't appear in chrome & firefox, is it a bug of ie or jquery, or my
codes?
Thanks.
No comments:
Post a Comment