在html中如何进行自动对焦输入 [英] in html how to make auto focus input

查看:204
本文介绍了在html中如何进行自动对焦输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在HTML中

?如何进行自动对焦输入

解决方案

 <  输入    type   =  text    id   =  txt    /  >  

< script type = text / javascript >

document )。ready( function (){


#txt)点击();
});
< / script >



这会将您的文本框集中在页面加载上。



编辑:作为解决方案#2(更好)的替代方案,您可以参考此解决方案。



-KR


in html ? how to make auto focus input

解决方案

<input type="text" id="txt" />

<script type="text/javascript">


(document).ready(function() {


("#txt").click(); }); </script>


This will focus your textbox on page load.

EDIT : As an alternative to solution #2 (which is better), you can refer this solution.

-KR


这篇关于在html中如何进行自动对焦输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆