jQuery附件对于所有现代浏览器都很好,但是对于ie8,它的工作并不完美。
有一个问题。我想附上超链接。它工作完美,但在IE中,它并不是附加超链接。
这是我的代码:
<div id="recent-posts-2" class="sidebar_wrapper widget_recent_entries widget">
<div class="sidebar_title clearfix">
<h3 class="fl widget-title">Recent Posts</h3>
</div>
<ul class="news_ul clearfix">
<li>
<span class="post-date">June 3, 2013</span>
<a href="http://domain.com/wood/china-conference-optional-tours/">China Conference & optional tours</a>
</li>
<li>
<span class="post-date">March 8, 2013</span>
<a href="http://domain.com/wood/hello-world/">Russia: Forest Industry Competitiveness & Export Outlook</a>
</li>
<li>
<span class="post-date">March 1, 2012</span>
<a href="http://domain.com/wood/u-s-moulding-market-supply-options-outlook-to-2017/">U.S. Moulding Market & Supply Options: Outlook to 2017</a>
</li>
</ul>
</div>
<script>
jQuery(function() {
jQuery('.widget_recent_entries .sidebar_title').append('<a href="<?php echo site_url(); ?>/news" class="fr news_more">more <i class="fa fa-arrow-circle-right"></i></a>');
});
</script>您可以检查这个jsbin是否为iE8,它没有附加超链接。需要帮助!
jsbin
发布于 2014-01-04 07:02:19
您在jQuery中遗漏了一个结束标记。
</i></a>另外,IE11 (边缘模式)似乎会阻塞jquery(document).ready类型的调用。然而,更改为快捷方法$(function(){code});似乎工作得很好。下面的javascript已经过测试并确认可以与Chrome,IE8+一起工作。
$(function(){
$('.widget_recent_entries .sidebar_title').append('<a href="<?php echo site_url();?>/news" class="fr news_more">more <i class="fa fa-arrow-circle-right"></i></a>');
});最后,请记住,jQuery 2.X只适用于IE9和更高版本(这不是这里的问题,而是对将来可能访问的用户的友好提醒)。
http://jsbin.com/isAgEXAX/12/edit
https://stackoverflow.com/questions/20918046
复制相似问题