[jQuery] input field focus help!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2769" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=095485206-17112006><FONT face=Arial color=#0000ff size=2>Thanks
Erik for the input, got the culprit...when thickbox is used, the
modal/dialog box link clicked doesn't fire-up the onload event which is the
reason why focus() doesn't work... c",)</FONT></SPAN></DIV>
<DIV><SPAN class=095485206-17112006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=095485206-17112006><FONT face=Arial color=#0000ff
size=2>anyway, i've created a link without using thickbox and just do
plain CSS, it now works! </FONT></SPAN></DIV>
<DIV><SPAN class=095485206-17112006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=095485206-17112006><FONT face=Arial color=#0000ff size=2>Thanks
again for the help...</FONT></SPAN></DIV>
<DIV><SPAN class=095485206-17112006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=095485206-17112006><FONT face=Arial color=#0000ff
size=2>cheers,</FONT></SPAN></DIV>
<DIV><SPAN class=095485206-17112006><FONT face=Arial color=#0000ff
size=2>cdelfino</FONT></SPAN></DIV>
<BLOCKQUOTE>
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> discuss-bounces@jquery.com
[mailto:discuss-bounces@jquery.com]<B>On Behalf Of </B>Erik
Beeson<BR><B>Sent:</B> Friday, November 17, 2006 10:36 AM<BR><B>To:</B> jQuery
Discussion.<BR><B>Subject:</B> Re: [jQuery] input field focus
help!<BR><BR></FONT></DIV>Ahh, right, that <SPAN
style="FONT-STYLE: italic">is</SPAN> the right code, but it doesn't work in
$(document).ready(...). I do it like this:<BR><BR>setTimeout(function()
{$('#username').get(0).focus();}, 250);<BR><BR>Inside $(document).ready(...).
Maybe moving it to load or something would work better. Haven't tried yet.
<BR><BR>--Erik<BR><BR>
<DIV><SPAN class=gmail_quote>On 11/16/06, <B class=gmail_sendername>Clodelio
Delfino</B> <<A
href="mailto:clodelio.delfino@mno.atmel.com">clodelio.delfino@mno.atmel.com</A>>
wrote:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV><SPAN><FONT face=Arial color=#0000ff size=2>Thanks Erik for the input
but it doesn't work... c",)</FONT></SPAN></DIV>
<DIV><SPAN class=e id=q_10ef32d6740c122a_1>
<DIV><SPAN></SPAN> </DIV>
<BLOCKQUOTE>
<DIV dir=ltr align=left><FONT face=Tahoma size=2>-----Original
Message-----<BR><B>From:</B> <A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:discuss-bounces@jquery.com"
target=_blank>discuss-bounces@jquery.com </A>[mailto:<A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:discuss-bounces@jquery.com"
target=_blank>discuss-bounces@jquery.com</A>]<B>On Behalf Of </B>Erik
Beeson<BR><B>Sent:</B> Friday, November 17, 2006 7:34 AM<BR><B>To:</B>
jQuery Discussion.<BR><B>Subject:</B> Re: [jQuery] input field focus
help!<BR><BR></FONT></DIV>.focus() does NOT set the focus of an element,
it fires all of the registered onfocus events. Use
$("").get(0).focus().<BR><BR>--Erik<BR><BR>
<DIV><SPAN class=gmail_quote>On 11/16/06, <B
class=gmail_sendername>Clodelio Delfino</B> <<A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:clodelio.delfino@mno.atmel.com"
target=_blank>clodelio.delfino@mno.atmel.com</A>> wrote:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">i've
downloaded thickbox and tried the login demo, the dialog box work
as<BR>expected however but when i tried to set an autofocus on the
username field,<BR>it doesn't work.<BR><BR>below is a snippet of the
code:<BR><BR>default.php has the clickable:<BR><BR><a
href="login.php?height=200&width=300" class="thickbox"
title="Please<BR>Login">Click Login</a><BR><BR><BR>login.php is
the form with code below:<BR><BR><!DOCTYPE html PUBLIC "-//W3C//DTD
XHTML 1.0 Transitional//EN"<BR>"<A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
target=_blank>http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
</A>"> <BR><html xmlns="<A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.w3.org/1999/xhtml"
target=_blank>http://www.w3.org/1999/xhtml</A>"><BR><head><BR><title>Test
Only</title><BR><meta http-equiv="content-type"
content="text/html;charset=utf-8"> <BR><script
type="text/javascript"<BR>src="./libraries/jquery-latest.pack.js"></script><BR><script
type="text/javascript"><BR> $(document).ready(function()
{<BR> /*$("#frmLogin
input[@name='frmUsername']").attr('disabled',true)*/ <BR>/* just to test
that im correctly referencing the correct field
*/<BR> $("#frmLogin
input[@name='frmUsername']").focus()<BR> })<BR></script><BR></head><BR><body><BR><!--
Section:Content --> <BR><div id="divContent"><BR><form
id="frmLogin" method="post"
action="check_credential.php"><BR><table
class="tblForm"><BR> <caption> </caption>
<BR> <tr><BR> <td
class="frmField">ID
Number</td><BR> <td
class="frmInput"><input name="frmUsername" type="text"
size="20"<BR>maxlength="20" /></td>
<BR> </tr><BR> <tr><BR> <td
class="frmField">Password</td><BR> <td
class="frmInput"><input name="frmPassword"
type="password"<BR>size="20" maxlength="20"
/></td><BR> </tr><BR> <tr><BR> <td> </td><BR> <td
class="frmInput"><BR> <input
name="btnLogin" type="submit" value="Login" />
<BR> </td><BR> </tr><BR></table><BR></form><BR></div><BR><!--
[Section:Content]
--><BR></body><BR></html><BR><BR><BR>Need inputs and
thanks in
advance....<BR><BR><BR>cdelfino<BR><BR><BR><BR>_______________________________________________<BR>jQuery
mailing list<BR><A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:discuss@jquery.com"
target=_blank>discuss@jquery.com</A><BR><A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://jquery.com/discuss/"
target=_blank>http://jquery.com/discuss/
</A><BR></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></SPAN></DIV></DIV><BR>_______________________________________________<BR>jQuery
mailing list<BR><A onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:discuss@jquery.com">discuss@jquery.com</A><BR><A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://jquery.com/discuss/"
target=_blank>http://jquery.com/discuss/</A><BR><BR><BR></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/