Javascript popover中的Bootstrap 4输入字段
标题中描述了该问题。 我有一个Bootstrap 4模式和一个带有按钮输入字段的popover。 在IE 11中,一切正常,但在Firefox中,输入失去了焦点 流行音乐:Javascript popover中的Bootstrap 4输入字段,javascript,jquery,css,bootstrap-4,bootstrap-5,Javascript,Jquery,Css,Bootstrap 4,Bootstrap 5,标题中描述了该问题。 我有一个Bootstrap 4模式和一个带有按钮输入字段的popover。 在IE 11中,一切正常,但在Firefox中,输入失去了焦点 流行音乐: $('[data-toggle="popover"]').popover({ container: "body", sanitize: false, content: function () { return $("#choose-user-popover-content").html
$('[data-toggle="popover"]').popover({
container: "body",
sanitize: false,
content: function () {
return $("#choose-user-popover-content").html();
}
}).on('shown.bs.popover', function () {
$('#ExecutorSNPSearchStr').focus();
});
Popover html:
<div id="choose-user-popover-content" style="display: none;">
<div class="row">
<div class="col">
<div class="input-group">
<input type="text" class="form-control" id="ExecutorSNPSearchStr" aria-describedby="ExecutorSNPSearchStrAddon"/>
<div class="input-group-append" id="ExecutorSNPSearchStrAddon">
<button class="btn btn-sm btn-outline-info w-3" type="button">
<i class="fas fa-search"></i>
</button>
<button class="btn btn-sm btn-outline-danger w-3" type="button">
<i class="fas fa-trash-alt"></i>
</button>
</div>
</div>
</div>
</div>
测试模态
&时代;
接近
保存更改
启动演示模式
有一个简单的错误,您的模式中有tabindex=“-1”
,因此您的输入焦点被它移除
对于引导4 模式+输入弹出框
$(函数(){
$('[data toggle=“popover”]')。popover({
容器:'主体',
标题:“搜索”,
是的,
位置:'底部',
消毒:错,
内容:功能(){
返回$(“#PopoverContent”).html();
}
});
})
测试模态
&时代;
接近
保存更改
启动演示模式
你需要提供完整的代码,这样我们就知道问题出在哪里了,我在一个单独的html文件中重新创建了这个情况。没有人知道吗?你说的是哪种焦点类型?popover中的输入字段没有输入焦点,Firefox中无法输入。太棒了!非常感谢你!我花了几天时间试图理解这个问题。奇怪的是,在Bootstrap4文档中没有关于这些事情的内容。再次非常感谢你!非常好的catch@NishargShah这个问题很奇怪,我们应该将这个问题报告给Bootstrap Repo,这样他们至少可以将它添加到他们的文档中,我考虑在github Repo中创建这个问题,但解决了这个问题后,我认为这是一个愚蠢的解决方案