gpt4 book ai didi

javascript - 带有按钮和输入的弹出式 HTML 内容未呈现

转载 作者:行者123 更新时间:2023-12-01 12:03:13 26 4
gpt4 key购买 nike

这个问题在这里已经有了答案:





html form inside bootstrap popover not working

(3 个回答)


2年前关闭。




我正在尝试将按钮添加到弹出窗口,但它似乎没有呈现。

是像我一样完成还是有更好的方法。

$('#myinput').popover({
trigger : "focus",
container : 'body',
placement : "bottom",
html : true,
title : "Choosy Popover",
content : `<input></input> Excellent <br><button type="submit">Why no display</button>`
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>

<input id="myinput" />

最佳答案

只需添加 sanitize: false

$('#myinput').popover({
trigger : "focus",
placement : "bottom",
html : true,
title : "Choosy Popover",
content : `<input></input> Excellent <br><button type="submit">Why no display</button>`,
sanitize : false, // here it is
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>

<input id="myinput" />

关于javascript - 带有按钮和输入的弹出式 HTML 内容未呈现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60001921/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com