大佬教程收集整理的这篇文章主要介绍了html – 在EditorFor上自动对焦,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
任何解决方案都将非常感谢,谢谢.
我的尝试:
@Html.EditorFor(model => model.description,new { htmlAttributes = new { @class = "form-control" },autofocus = "" })
@Html.TextBoxFor(model => model.Name,new { htmlAttributes = new { @class = "form-control" },autofocus="autofocus"})
或者你可以使用jQuery做到这一点:
<div class="editor-field focus"> @Html.EditorFor(model => model.description) @Html.ValidationmessageFor(model => model.description) </div> $(function() { $('.focus :input').focus(); });
更新:如你所知,TextBoxFor总是创建一个带有类型输入的文本框,但是EditorFor有点聪明,它会根据属性的数据类型呈现标记.
以上是大佬教程为你收集整理的html – 在EditorFor上自动对焦全部内容,希望文章能够帮你解决html – 在EditorFor上自动对焦所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。