yeah I answered my own question! Here is the solution try { $("#user").focus(); } catch(err){ return false; }
On Sep 20, 1:37 pm, njsuperfreak <[EMAIL PROTECTED]> wrote: > Benjamin, > thanks for you response. > Okay I have a login form with a input field named (user) set to focus($ > ("#user").focus();). > > When the checks the remember me checkbox, a cookie is created, so the > next time the user logs in his/her username is displayed in this form, > and the inputs (user) and (pass) are both hidden. That script works > fine, but the problem I have is jquery looks to focus ($ > ("#user").focus();) on the input field (user) that is no longer there, > cause this is now a differnt form and the fields are not there so I > get an error. I hope this helps. > > <!--- example --> > <form> > <input id="user" type="text" size="14" name="user" onclick=""/> > <input id="pass" name="pass" type="password" size="14" > class="usertxt" /> > <span class="rmbme">Remember Me</span><input name="checker" > type="checkbox" id="checker"/> > <input name="Login" type="submit" onclick="javascript:formsub();" > value="Login" style="cursor:pointer" /> > </form>