Jump to content

Not able to focus


naag

Recommended Posts

Title<img src="images/smallindex.jpg" /></td><td><html:select property="title"><html:option value="">--SELECT--</html:option><html:option value="Mr."></html:option><html:option value="Mrs."></html:option></html:select></td><html:submit value="submit" styleClass="button" property="method" onclick="onSave()"/>function onSave(){if(document.forms[0].title.value==""){alert("Title should not be left blank");document.forms[0].getElementById('personalInformation').title.focus();//document.forms[0].title.focus();return false;}} i donno what wrong in this script, it not focusing on title if it is empty....can u please someone help me..thanks ...

Edited by naag
  • Like 1
Link to comment
Share on other sites

Just document.getElementById(). You don't need the forms[0] part, and the ID should be the ID of the specific input you want focused. document.getElementById("title").focus();

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...