使用单个JQuery为不同的文本框设置焦点 [英] Set Focus for different Textboxes using single JQuery
本文介绍了使用单个JQuery为不同的文本框设置焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的网络表单中,我有10个文本框。当按下Enter / Return时,我需要关注下一个文本框。是否有任何方法可以通过使用单个jquery函数来实现这一点而无需编写10个不同的函数
解决方案
快速搜索让我找到了这个OS回答 [ ^ ]有一个示例链接,可以满足您的需求。
链接: http://www.latentmotion.com/downloads/enter-to-tab.html [ ^ ]
来源:< pre lang =xml> < !DOCTYPE html PUBLIC < span class =code-attribute> - // W3C // DTD XHTML 1.0 Transitional // EN http://www.w3.org/TR/xhtml1 /DTD/xhtml1-transitional.dtd\">
< < span class =code-leadattribute> html xmlns = http://www.w3.org/1999/xhtml >
< head >
< meta http-equiv = 内容类型 内容 = text / html; charset = UTF-8 / > ;
< script type =' text / javascript' src =' http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js?ver=1.3.2' > < / script >
< script 类型 = text / javascript >
(document).ready(function(){
( 输入)。不(
In my webform, I have 10 textboxes. I need to focus on the next textbox when Enter/Return is pressed. Is there any way to achieve this by just using a single jquery function without writing 10 different function
解决方案
A quick search landed me on this OS answer[^] which has a link to an example which does what you want.
The link: http://www.latentmotion.com/downloads/enter-to-tab.html[^]
The source:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js?ver=1.3.2'></script> <script type="text/javascript">
(document).ready(function(){
("input").not(
这篇关于使用单个JQuery为不同的文本框设置焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文