所以我正在研究一个ASP.NET项目,并尝试使用jQuery脚本作为内场标签,但是它显示的是文本框上方的标签,而不是内部...已经在这个工作了几个小时并且避风港我想出了一个解决方案,所以我来到这里,我的代码在下面,感谢任何建议!
这是我正在使用的jQuery脚本的链接:http://fuelyourcoding.com/scripts/infield/
@{
ViewBag.Title = "LostPassword";
}
@using (Html.BeginForm("LostPassword", "Account"))
{
<script type="text/javascript" src="../../Scripts/jquery.infieldlabel.min.js" ></script>
<script type="text/javascript">
$(document).ready(function () {
$("label").inFieldLabels();
});
</script>
<fieldset>
<table class="layout full-width key-value">
<tr>
<td>
<h2>Forgot your password?</h2>
<br />
<p><b>To reset your account password:</b></p>
<p><b>1.</b> Please enter your username in the below box and click "Reset". Your username could be your E-mail address, or it may be a username you created when you set up your account.</p>
<p><b>2.</b> You will recieve an E-Mail with a link to reset your password. Follow the link and the instructions on that page to update your password.</p>
</td>
</tr>
<tr>
<td style="position: relative">
<label for="UserName" style="position:absolute; top:0; left:0">User Name</label>
@Html.TextBox("UserName")
</td>
</tr>
</table>
<input type="submit" value="Reset my password" />
</fieldset>
}
答案 0 :(得分:1)
给标签和/或文本框(输入)的css查看负边距,没有附加位置的浮动。单击文本框时它是否会消失,如果这样意味着jQuery 100%正常并且问题在您的CSS中。