我正在寻找创建一个表单,在其中按Enter键可使焦点移至页面上的“下一个”表单元素。那是我的代码,但在引导程序中无法与“ selectpicker”一起使用 HTML代码
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="col-md-6 pdr0 ">
<div class="col-md-12 pdl0 pdt5">DOB</div>
<div class="col-md-12 pdl0 pdb0 pdt0">
<asp:TextBox ID="DOB" runat="server" TabIndex="7" CssClass="TextBox validate[required] " />
<span class="required"></span>
</div>
</div>
<div class="col-md-6 pdr0 ">
<div class="col-md-12 pdl0 pdt5">Level</div>
<div class="col-md-12 pdl0 pdb0 pdt0">
<asp:DropDownList ID="Level" TabIndex="8" runat="server" CssClass="selectpicker validate[required]" />
<span class="required"></span>
</div>
</div>
<script>
$('body').on('keydown', 'input,button, a, select, textarea', function (e) {
var self = $(this), form = self.parents('form:eq(0)'), focusable, next;
if (e.keyCode == 13) {
focusable = form.find('input,button,a,select,textarea').filter(':visible:not([readonly]):enabled');
next = focusable.eq(focusable.index(this) + 1);
if (next.length) { next.focus(); } else { form.submit(); }
return false;
}
else if (e.keyCode === 113) {
$(".cmsbtupdate").click();
}
});
</script>