Focus on Field

…this post was published on 2012 August 2011.

This document started from a topic on Sharepoint Forum

The easiest way in which you can set focus on some element in the form, is to use a little javascript function.
For example, I called this function: action()  and  the code contained is this line

document.getElementById(‘elementID’).focus();

When this form will load in your browser, will focus on the element specified by elementID
As you know, each element in HTML code can be identified by an ID using a syntax like this in his tag:ID=’element1′

That function action() it’s called onload() of the body tag

<body onload=”action()”>   (  some html code removed – not necesarry for this example )

This entry was posted in Coding, Javascript. Bookmark the permalink.