jed*_*mao 9 javascript jquery html5 dom internet-explorer-8
我发现了一些类似问题的帖子,但这是不同的.在我阅读了另一篇文章后,我从jQuery 1.4升级到1.4.2,但问题仍然存在.我也试过在兼容模式下运行IE 8,似乎没什么用.当然,它在Chrome中运行得非常好.
这是标记:
<section class="pleaseWaitButton">
<p><img src="images/please_wait.png" alt="Please wait" /></p>
<p><input type="image" src="images/add_to_cart.png" alt="Add to cart"/></p>
</section>
Run Code Online (Sandbox Code Playgroud)
这是唯一的jQuery选择是做在这种情况下工作...
$('.pleaseWaitButton').length // 1
Run Code Online (Sandbox Code Playgroud)
这里的jQuery选择器不起作用!
$('.pleaseWaitButton').find('input').length // 0
$('.pleaseWaitButton input').length // 0
$('.pleaseWaitButton > p > input').length // 0
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?任何人...?
med*_*iev 10
Internet Explorer 8对HTML 5,IE6和IE7平台的支持很奇怪,只是不支持它.
您需要SHIV HTML 5个的元素,以风格和正确使用方法/属性,如innerHTML的,的getElementsByTagName他们.
这将适用于IE6-IE8:
<!doctype html>
<html>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<section class="pleaseWaitButton">
<p><img src="images/please_wait.png" alt="Please wait" /></p>
<p><input type="image" src="images/add_to_cart.png" alt="Add to cart"/></p>
</section>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
<script>
alert( $('.pleaseWaitButton').find('input').length )
alert( $('.pleaseWaitButton input').length )
alert( $('.pleaseWaitButton > p > input').length )
</script>
</html>
Run Code Online (Sandbox Code Playgroud)
现场演示:http://medero.org/html5.html