我有多个 div,每个 div 都有一个文本框和一个标签。当文本框位于 .focus 时,我需要在标签中填充一些文本
到目前为止的脚本:
$(function () {
$('input:text').focus(function () {
//how do I get the current label and populate with some text? and when clicking on a
//different textbox, I want to clear the previous label and just show the current
//div's label with some data
});
});
例如
<div>
@Html.TextBoxFor(model => model.Title)
<label>
</label>
</div>
<div>
@Html.TextBoxFor(model => model.Name)
<label>
</label>
</div>
<div>
@Html.TextBoxFor(model => model.Address)
<label>
</label>
</div>
谢谢!