IE8:jQuery追加不起作用

Jac*_*ris 2 html jquery internet-explorer-8

jQuery append适用于所有现代浏览器,但对于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 &amp; 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 &amp; 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 &amp; 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>
Run Code Online (Sandbox Code Playgroud)

你可以检查这个jsbin for iE8它没有附加超链接.需要帮忙.!

jsbin

Tom*_*mmy 5

您缺少在jQuery中关闭标记.

</i></a>
Run Code Online (Sandbox Code Playgroud)

另外,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>');
  });
Run Code Online (Sandbox Code Playgroud)

最后,请记住,jQuery 2.X仅适用于IE9及更高版本(这不是问题,但是对未来可能会访问的人提醒).

http://jsbin.com/isAgEXAX/12/edit