如何更改文本框的背景颜色(文本框在剃刀视图中)onFocus 或 onBlur。我不明白要使用哪个选择器。
我的剃须刀
@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<fieldset>
<legend>student</legend>
@Html.HiddenFor(model => model.id)
<div class="editor-label">
@Html.LabelFor(model => model.firstname)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.firstname)
@Html.ValidationMessageFor(model => model.firstname)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.lastname)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.lastname)
@Html.ValidationMessageFor(model => model.lastname)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.fathername)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.fathername)
@Html.ValidationMessageFor(model => model.fathername)
</div>
<p>
<input type="submit" value="Save" />
</p>
</fieldset>
}
渲染后的剃刀
<div class="editor-label">
<label for="firstname">firstname</label>
</div>
<div class="editor-field">
<input class="text-box single-line" id="firstname" name="firstname" type="text" value="test1" />
<span class="field-validation-valid" data-valmsg-for="firstname" data-valmsg-replace="true"></span>
</div>
<div class="editor-label">
<label for="lastname">lastname</label>
</div>
<div class="editor-field">
<input class="text-box single-line" id="lastname" name="lastname" type="text" value="test1" />
<span class="field-validation-valid" data-valmsg-for="lastname" data-valmsg-replace="true"></span>
</div>
现在我应该在脚本中使用什么标签来引发事件 onFocus 和 onBlur 我尝试使用“textbox”、“text-box single-line” 使用这些和其他一些作为选择器,但它们正在工作,有人帮助我应该使用哪个选择器采用