我正在尝试自定义用于引导程序弹出窗口的模板。我找到了......
$('.item').popover({
html : true,
placement: 'left',
content: function(){
return $(this).next('.our-popup').html();
},
template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
})
这很棒!但现在我想让模板动态化,所以我改为以下
template: $(this).next('.our-popup').next('.our-template').html();
我收到错误。
Uncaught TypeError: Cannot read property 'offsetWidth' of undefined
我也试过了......
template: function(){
return $(this).next('.our-popup').next('.our-template').html();
}
我得到......
Uncaught HierarchyRequestError: Failed to execute 'appendChild' on 'Node': Nodes of type '#document' may not be inserted inside nodes of type '#document-fragment'.