自动对焦仅在下次启动模型时加载页面时才起作用,自动对焦在输入类型中不起作用
<div class="modal fade" id="OrganModal" role="dialog">
<div class="modal-dialog mainModal">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Organ List</h4>
</div>
<div class="modal-body">
<div class="divSearch orgsearch" tabindex="1">
<div class="SearchBox">
<input type="text" onkeyup="OrganSearch()" id="btnTextOrgan" placeholder="Search" autofocus="autofocus" />
</div>
<div class="SearchAction">
<div class="SearchActionAlign">
<a href="#" onclick="clearSearchResultOfOrgan()" class="NonAction ActionClick">
<img src="../../assets/images/icons/close.png" alt="Cancel" class="ImgClose" />
</a>
</div>
</div>
</div>
<div id="organList" class="organ_list"></div>
</div>
</div>
</div>
</div>
3条答案
按热度按时间3zwtqj6y1#
由于bootstrap是在去掉
autofocus
的模态上应用tabindex=-1
的......所以尝试使用bootstrap模态的shown.bs.modal
方法堆栈代码段
mbjcgjjk2#
之后在modal中将
autofocus
属性添加到input
。在脚本中添加
rekjcdws3#