javascript problem

Soldato
Joined
1 Feb 2006
Posts
8,188
hi, trying to do some javascript validation here and I want to set the focus back to a certain field if it is empty.

This is the code I am using but this doesn't seem to work! Any ideas?

Code:
document.getElementById("title").focus();
 
No reason why it shouldn't work. Post all of the code (how you are calling said method etc.)

Just for reference, the following works:
Code:
function focusId(id)
{
	document.getElementById(id).focus();
}
<p onclick="focusId('title');">HILOL</p>
<input type="text" id="title">
 
Back
Top Bottom