我有一个输入文本是这样的:
<div class="editor-label">
@Html.LabelFor(model => model.EmployeeId, "Employee Number")
</div>
<div class="editor-field textBoxEmployeeNumber">
@Html.EditorFor(model => model.EmployeeId)
@Html.ValidationMessageFor(model => model.EmployeeId)
</div>
生成以下html
< div class = " editor-label”> <label for="EmployeeId">员工号</label> . < / div > <div class="editor-field textBoxEmployeeNumber"> <input class="text-box single-line" data-val="true" data-val-number="The field EmployeeId must be a number." data-val-required="The EmployeeId field is required." id="EmployeeId" name="EmployeeId" type="text" value="" /> . <span class="field-validation-valid" data-valmsg-for="EmployeeId" data-valmsg-replace="true"></span> . < / div >
我想用jquery设置这个输入文本的值,所以我这样做:
<script type="text/javascript" language="javascript">
$(function() {
$('.textBoxEmployeeNumber').val("fgg");
});
</script>
然而,它并没有起作用…我的语法有什么错误?