Toggle navigation menu
OpenNTF Snippets
Other Sites
OpenNTF
Collaboration Today
XPages.info
Anonymous
Login
Back
Set focus on input field
You have to login first to use 'My Favorites' feature
3 user(s) has marked as favorite:
Erskine Harris
Johan Sundin
Mike R Kelly
Language
JavaScript (Client)
Tags
Author
Mark Leusink
Submitted on
November 21, 2011 at 4:03 AM
Rating
Downloads
1,137
Notes
Sets the focus (cursor) in the specified field. The code won't throw an error if the field can't be found of can't get the focus.
In the sample code "inputName" is the id of the input control you want to set the focus on.
Select XSnippet to copy to Clipboard
Embed XSnippet
Report
try { dojo.byId("#{id:inputName}").focus(); } catch (e) { }
All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the
Apache License Version 2.0
. See
Terms of Use
for full details.
No comments yet
Login first to comment...
Toggle navigation menu
Hosted by OpenNTF
Terms of Use
Privacy Policy
Contact OpenNTF
Follow OpenNTF
Follow Snippets