Set focus on input field

try {
 dojo.byId("#{id:inputName}").focus();
} catch (e) { }





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.

JavaScript (Client)
Mark Leusink
November 21, 2011 5:03 AM
Rating
1,005

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 yetLogin first to comment...