Javascript 引导popover中的HTML标记不会呈现
我遇到了一个问题,我无法理解为什么popover中的HTML标记无法呈现 JS小提琴在这里: 流行音乐:Javascript 引导popover中的HTML标记不会呈现,javascript,jquery,twitter-bootstrap-3,bootstrap-popover,Javascript,Jquery,Twitter Bootstrap 3,Bootstrap Popover,我遇到了一个问题,我无法理解为什么popover中的HTML标记无法呈现 JS小提琴在这里: 流行音乐: <!-- Content for Popover #1 --> 无法显示代码 工作很好,但它只是基于文本 我做错了什么?您只需添加选项即可 sanitize: false 它不会清理内容,并根据需要呈现输入字段,如此处的选项所示: 完整示例: $(function(){ $("[data-toggle=popover]").popover({ san
<!-- Content for Popover #1 -->
无法显示代码
工作很好,但它只是基于文本
我做错了什么?您只需添加选项即可
sanitize: false
它不会清理内容,并根据需要呈现输入字段,如此处的选项所示:
完整示例:
$(function(){
$("[data-toggle=popover]").popover({
sanitize: false // <-- ADD HERE
html: true,
content: function() {
var content = $(this).attr("data-popover-content");
return $(content).children(".popover-body").html();
},
title: function() {
var title = $(this).attr("data-popover-content");
return $(title).children(".popover-heading").html();
}
});
});
$(函数(){
$(“[data toggle=popover]”。popover({
sanitize:false/您只需添加到选项中即可
sanitize: false
它不会清理内容,并根据需要呈现输入字段,如此处的选项所示:
完整示例:
$(function(){
$("[data-toggle=popover]").popover({
sanitize: false // <-- ADD HERE
html: true,
content: function() {
var content = $(this).attr("data-popover-content");
return $(content).children(".popover-body").html();
},
title: function() {
var title = $(this).attr("data-popover-content");
return $(title).children(".popover-heading").html();
}
});
});
$(函数(){
$(“[data toggle=popover]”。popover({
sanitize:false//这可能会帮助您:这可能会帮助您:非常感谢!我完全错过了它!请记住,这允许有人在您的组件上注入XSS:data content=“alert('XSS')”
我正在运行bootstrap 3.4,添加sanitize修复了我的同一问题。非常感谢!我完全错过了它!请记住,这允许有人在组件上注入XSS:data content=“alert('XSS')”
我正在运行bootstrap 3.4,添加sanitize修复了我的同一问题。
$(function(){
$("[data-toggle=popover]").popover({
sanitize: false // <-- ADD HERE
html: true,
content: function() {
var content = $(this).attr("data-popover-content");
return $(content).children(".popover-body").html();
},
title: function() {
var title = $(this).attr("data-popover-content");
return $(title).children(".popover-heading").html();
}
});
});