On Tuesday, November 14, 2006 7:35 AM Klaus Hartl <> said: > Most browsers don't focus a field from > a link pointing to the field's id, so I usually add a click event to > explicitly focus the form element. The field to focus is simply read > from the link's href...
Unless I'm misunderstanding your implementation, your problem is that you're using the wrong tag. Don't use an anchor+js to link an error message with its field. You should be using <label> instead. <label for="first_name">This field cannot be empty.</label> <input id="first_name" type="text" size="20"/> You can have as many <label>s as you want pointing to the same field. This will make the browser put focus is the field where name="id_of_form_field". <div id="errors"> <label for="first_name">Error with First Name</label> </div> <form ...> <label id="first_name">First Name</label> <input id="first_name" .../> </form> Both of the above labels will put focus in the first_name field when clicked. Use CSS to style the label(s) however you want. Chris. _______________________________________________ jQuery mailing list [email protected] http://jquery.com/discuss/
