What about $("#whatever")[0].focus();

Glen


On 11/16/06, Clodelio Delfino <[EMAIL PROTECTED]> wrote:

 Thanks Erik for the input but it doesn't work... c",)


-----Original Message-----
*From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of *Erik Beeson
*Sent:* Friday, November 17, 2006 7:34 AM
*To:* jQuery Discussion.
*Subject:* Re: [jQuery] input field focus help!

.focus() does NOT set the focus of an element, it fires all of the
registered onfocus events. Use $("").get(0).focus().

--Erik

On 11/16/06, Clodelio Delfino <[EMAIL PROTECTED]> wrote:
>
> i've downloaded thickbox and tried the login demo, the dialog box work
> as
> expected however but when i tried to set an autofocus on the username
> field,
> it doesn't work.
>
> below is a snippet of the code:
>
> default.php has the clickable:
>
> <a href="login.php?height=200&width=300" class="thickbox" title="Please
> Login">Click Login</a>
>
>
> login.php is the form with code below:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> <html xmlns="http://www.w3.org/1999/xhtml";>
> <head>
> <title>Test Only</title>
> <meta http-equiv="content-type" content="text/html;charset=utf-8">
> <script type="text/javascript"
> src="./libraries/jquery-latest.pack.js"></script>
> <script type="text/javascript">
>     $(document).ready(function() {
>         /*$("#frmLogin
> [EMAIL PROTECTED]'frmUsername']").attr('disabled',true)*/
> /* just to test that im correctly referencing the correct field */
>         $("#frmLogin [EMAIL PROTECTED]'frmUsername']").focus()
>     })
> </script>
> </head>
> <body>
> <!-- Section:Content -->
> <div id="divContent">
> <form id="frmLogin" method="post" action="check_credential.php">
> <table class="tblForm">
>     <caption>&nbsp;</caption>
>     <tr>
>         <td class="frmField">ID Number</td>
>         <td class="frmInput"><input name="frmUsername" type="text"
> size="20"
> maxlength="20"  /></td>
>     </tr>
>     <tr>
>         <td class="frmField">Password</td>
>         <td class="frmInput"><input name="frmPassword" type="password"
> size="20" maxlength="20" /></td>
>     </tr>
>     <tr>
>         <td>&nbsp;</td>
>         <td class="frmInput">
>             <input name="btnLogin" type="submit" value="Login" />
>         </td>
>     </tr>
> </table>
> </form>
> </div>
> <!-- [Section:Content] -->
> </body>
> </html>
>
>
> Need inputs and thanks in advance....
>
>
> cdelfino
>
>
>
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/



_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to