javascript - Mustache JS 无法在 IE8 中呈现

标签 javascript mustache

我有一个动态模板,当页面加载时,我将其附加到 div 上,它可以在 Chrome 和其他一些浏览器上运行,但在 IE8 中不起作用。

知道为什么它在 IE8 中不起作用吗?

代码如下

var notificationDetails = {
    dangerMessage: "",
    seats: data.seatRemaining,
    class:"product-notification-danger"
};

var templates = '<div class="panel {{class}}"><button type="button" class="close" data-target="#product-notification" data-dismiss="alert"><span aria-hidden="true" style=" border: 4px solid #fff; border-radius: 50%; display: block; color: #FFFFFF; background-color: rgba(0,0,0.6); font-size: 25; width: 32px; margin-right: 5px; margin-top: 5px; ">&times;</span><span class="sr-only">Close</span> </button> <div class="notication"> <div class="notification-section"><img src="/media/13583871/ms-device.png" width="126" class="mCS_img_loaded"></div><div class="notification-section"><div class="panel-heading"> <span class="product-notification-title">Protect <span id="remaining-seats">{{seats}}</span> more devices.</span></div><div class="panel-body"> <p>{{dangerMessage}}</p><p><a href="#" style="color:#fff; font-size: 14px; text-transform: uppercase; font-weight: 700;">Learn More <span class="glyphicon glyphicon-circle-arrow-right">&nbsp;</span></a></p></div></div></div></div>'

$('#product-notification').append(Mustache.to_html(templates, notificationDetails));

最佳答案

它只是让脚本在我的 IE8 中运行。

enter image description here

我想说它根本不被支持(不再)。而且我还认为你不需要支持IE8。或者有什么理由这样做?

关于javascript - Mustache JS 无法在 IE8 中呈现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44943861/

相关文章:

javascript - Web 应用程序的数据驱动表单

javascript - 响应式 html 内容轮播插件或不带

javascript - 如何制作一个简单的 HTML CSS 时间图

javascript - 使用mustache.js为静态网站的所有页面添加内容容器

haml - Markdown 内部的 Handlebars ,HAML 内部

javascript - Mustache Js View 中的各种对象

javascript - 部分/模板继承在 Mustache 中如何工作?

javascript - Paper.js 鼠标事件不工作

javascript - $this->input->post() 在 codeigniter 中总是空的

javascript - 带有 html5 和 JS 的子窗口?