嗨我想知道如何通过在MVC5中按Enter键导航从一个字段到另一个字段。如何使用MVC5中的输入键功能从一个字段导航到另一个字段
我查看
<form>
<fieldset>
<div class="col-sm-3">
<div class="form-group">
<span style="color: #f00">*</span>
@Html.Label("Employee Name", new { @class = "control-label" })
@Html.DropDownList("EmployeeID", null, "Select", new { @class = "form-control required" })
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<span style="color: #f00">*</span>
@Html.LabelFor(model => model.Date, new { @class = "control-label" })
@Html.TextBoxFor(model => model.Date, new { @class = "form-control required", type = "text", id = "Date" })
</div>
</div>
<div class="col-sm-3" style="float:left">
<div class="form-group">
<span style="color: #f00">*</span>
@Html.LabelFor(model => Model.CustomerName, new { @class = "control-label" })
@Html.TextBoxFor(model => Model.CustomerName, new { @class = "form-control" })
@Html.HiddenFor(model => Model.CustomerID)
</div>
</div>
<div class="col-sm-4" id="VisitType">
<div class="form-group">
<span style="color: #f00">*</span>
@Html.Label("Visit Type", new { @class = "control-label" })
@Html.RadioButtonFor(model => model.VisitType, "true", new { id = "" }) Telephone
</label>
<label>
@Html.RadioButtonFor(model => model.VisitType, "false", new { id = "" }) Direct Visit
</label>
</div>
</div>
<form>
<fieldset>
我Ĵ查询
$("form:not(.filter) :visible:enabled:first").focus();
$('form > div').keypress(function(e) {
debugger;
if (e.keyCode == 13) {
e.preventDefault();
if ($(this).next().length > 0) {
$(this).next().children('div').children(":not(label)").focus();
} else {
$("form:not(.filter) :visible:enabled:first").focus();
}
}
});
我的CSS
下面这段代码工作鳍片在小提琴中。但是这个代码在我的View中不起作用。为什么,因为我不知道我在哪里必须在我的视图中声明这个CSS。请任何人检查我的代码,并告诉我这个问题的建议。在我有脚本文件夹中的css文件之前。所以我在我的视图中拖动并保留该css文件。我donno并没有任何css文件的这个关键功能。所以,请任何人告诉我,我必须在我的视图中声明该css编码。任何人都建议我改变方法。我尽力解释我的问题。任何一个明白,并给我解决方案
谢谢。
是它的局部视图 – lordkain
不,它不是一个局部视图。这只是一个主要观点? –