我有多个div,每个div都有一个文本框和一个标签。我需要填充在标签的一些文本时,文本框是.focusJquery获取div的当前标签并填充
脚本至今:
$(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>
thx!
你真的,真的不需要发布截图。我们的浏览器渲染页面就好了。 – Blazemonger 2012-04-18 17:43:07
真的相信我,有时真的会失败。我用很多代码回答了以前的问题,并且浪费了时间格式化所有代码。 – 2012-04-18 17:52:44
把实际的代码放在这样的地步,人们可以很容易地复制和粘贴它。也不能保证您的图片托管服务将在明天发布。你需要做的是学习使用SO内置的代码格式工具。 – Blazemonger 2012-04-18 18:01:40