我有一个问题,我无法弄清楚究竟是什么导致这种行为.我无法textarea在HTML表单上访问输入字段和s.
不幸的是,JS,HTML和CSS非常大,所以我不能在这里发布所有内容.
调试这个奇怪的行为时,有人能告诉我要找什么吗?
UPDATE
如果我将光标移动到该input字段上,我可以看到文本光标,但是当我单击它时,该字段不会获得焦点.我可以通过按键访问该字段Tab,如果我右键单击它然后单击该字段我也得到它的焦点.
......和不,他们没有disabled或readonly属性;-)
我正在尝试使用select2内部引导模式但它不会自动获得焦点以及向下和向上箭头不适用于填充列表.
当我把它放在模态弹出窗口之外时,同样的select2工作.
当我搜索时,我发现很多人都遇到了同样的问题并发现了这篇文章
我实现了它的两个解决方案
tabindex从模态弹出窗口中删除.enforceFocusmodal.js文件中注释的函数代码.但它仍然无法正常工作!知道我还能错过什么吗?
EDIT1
它适用于firefox何时tabindex从模态div中删除但不是IE9
EDIT2
我发现删除tabindex实际上没有得到认可,IE9因为我仍然可以通过IE中的转义键隐藏弹出窗口,但不会隐藏在Firefox中.
无法输入Select2下拉输入搜索字段(http://kevin-brown.com/select2/)
我发现列出的许多问题都提到了同样的问题,但对我没什么用(https://www.google.com/search?q=can%27t+type+in+select2&ie=utf-8&oe=utf-8&client=firefox -b-ab).我无法使用jQuery在模型对话框中输入Select2下拉输入搜索字段.顺便说一下,我可以从下拉菜单中选择价值.尝试插入tabindex:0但没有运气.
$.ajax({
type: "POST",
url: "<?php echo $myScripts; ?>",
data: { id1: "get-release-dropdown-html", id100: "<?php echo $dbTable; ?>" },
success:function(releaseDropdown){
$('#progress').hide();
$( "#modelDialog1" ).dialog({
modal: true,
width: '570',
height: '600',
resizable: true,
position:
{
my: "center",
at: "center",
of: window,
},
title: "Trigger Build",
open: function() {
$(this).html("<br/>Please select job options.<br/><br/><br/><b>Release:</b>" + releaseDropdown + "<div style='margin-top:30px;'/><b>Build Release Candidate:</b><select id='sReleaseCandidate'><option value='ga' selected>GA</option><option value='beta1'>BETAX</option>'></br>");
$("#sDescription").focus();
$("#sRelease, #sReleaseCandidate").select2({
tags: true
});
},
close: function() {
$( …Run Code Online (Sandbox Code Playgroud) 如果日期选择器中的月份选择在引导模式中,则它在FireFox中不起作用.
<button class="btn" id="btn">Click Me</button>
<div class="modal hide" id="modal" tabindex="-1">
<div class="modal-body">
<input type="text" id="datepicker" />
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
JavaScript的:
$("#datepicker").datepicker({"changeMonth": true});
$('#btn').click(function() {
$("#modal").modal('show');
});
Run Code Online (Sandbox Code Playgroud)
这是一个缩小的例子:http://jsfiddle.net/nKXF2/
我找到了一个类似的twitter-bootstrap github问题:https://github.com/twbs/bootstrap/issues/5979
select2 位于 bootstrap 4 模态中,并且仅发生在模态中。
请参阅上面的屏幕截图,当我单击该元素时,它会显示,然后关闭。
在 Chrome 控制台中,我看到这些警告
[Violation] Avoid using document.write().
[Violation] Forced reflow while executing JavaScript took 33ms
[Violation] 'readystatechange' handler took 151ms
Run Code Online (Sandbox Code Playgroud)
这是我的代码
[Violation] Avoid using document.write().
[Violation] Forced reflow while executing JavaScript took 33ms
[Violation] 'readystatechange' handler took 151ms
Run Code Online (Sandbox Code Playgroud)
P/S:这并不总是发生
我已经为这个问题争论了一个多星期,但几乎没有任何进展。
我看过
最后,查看https://select2.org/troubleshooting/common-problems后
我尝试同时应用dropdownParent: $('#myModal')和
// Do this before you initialize any of your modals
$.fn.modal.Constructor.prototype.enforceFocus = function() {};
Run Code Online (Sandbox Code Playgroud)
这些修复都不起作用,所以我真的束手无策,准备完全放弃使用模式。基本上,我从服务器获取 JSON 对象中的数据,然后使用该数据填充模式。除第一个组合框之外的所有元素(其中一些是选择/组合框)的填充工作正常。
预先感谢您的帮助,如果答案发布在其他地方,我很抱歉,但我找不到它。以下是相关代码:
<!-- Modal to Add / Edit Delay parent div must have same id as value of the data-target attribute used to trigger the modal -->
<div class="modal fade" id="delayAddModal" tabindex="-1" role="dialog" aria-labelledby="delayAddLabel">
<div class="modal-dialog" role="document">
<!-- …Run Code Online (Sandbox Code Playgroud) javascript asp.net-mvc jquery jquery-select2 bootstrap-modal