MVC视图属性使用
1、在視圖中自定義一個控件格式:? @Html.TextBox("txtemail", "", new { id = "txt_UserName", style = "width:280px;height:34px", @class = "input-easyui", @readonly = true })
2、在視圖中綁定控件鍵盤觸發(fā)事件:
$('#txt_UserName').combobox().next('span').find('input').bind("keyup", function (event) {var e = event || window.event; //火狐和其他瀏覽器取值var keyCode = e.keyCode || e.which;if (keyCode == 13 && document.activeElement.value != null && document.activeElement.value != "") {$(document).ready(function () { $("#txtNumber").focus(); });}});3、JS給域文本框賦值方式:?
控件定義:? ? @Html.TextAreaFor(model => model.RecordedRemark, new { @class = "easyui-validatebox form-control", @readonly = true })
?JS賦值:$("[name='RecordedRemark']").text(r.RecordedRemark);
4、JS給文本框輸入焦點? $(document).ready(function () { $("#txt_expressno").focus(); });
5、Combobox下拉框動態(tài)去掉驗證屬性(required):$('#youPropertyId').combobox({ required: false });
轉載于:https://www.cnblogs.com/leojon/p/4475508.html
總結
- 上一篇: MySQL原生HA方案 – Fabric
- 下一篇: 传智播客JavaWeb day11--事