[jQuery] set focus?

2006-11-06 Thread Jez McKean



I see focus() will 
run the events tied to an elements onfocus, but how can I set the 
focus.
(e.g. click button 
to un-disable a textinput, then set the focus on said 
input.)

Regards,
Jez
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] set focus?

2006-11-06 Thread Sam Collett
On 06/11/06, Jez McKean [EMAIL PROTECTED] wrote:


 I see focus() will run the events tied to an elements onfocus, but how can I
 set the focus.
 (e.g. click button to un-disable a text input, then set the focus on said
 input.)

 Regards,
  Jez

$(#myinput)[0].focus()

Perhaps calling focus ($(#myinput).focus()) should actually set the
focus on the element as well as fire the onfocus event - rather than
just fire the event.

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


Re: [jQuery] set focus?

2006-11-06 Thread Jörn Zaefferer
 Perhaps calling focus ($(#myinput).focus()) should actually set the
 focus on the element as well as fire the onfocus event - rather than
 just fire the event.

It would help if the event shortcuts were less ambigous, eg. onfocus() instead 
of focus(). If so, it would be easy to add focus to actually call focus on the 
first element, eg.

jQuery.fn.focus = function() {
  if(this.length  0)
this[0].focus();
  return this;
};

I wonder if that would trigger the focus events for that element...

--
Jörn Zaefferer

http://bassistance.de
-- 
GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist!
NEU: Jetzt bis zu 16.000 kBit/s! http://www.gmx.net/de/go/dsl

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


Re: [jQuery] set focus?

2006-11-06 Thread Jez McKean
Great, thanks. :)

BTW: I have found that this is also true of .select()


 Perhaps calling focus ($(#myinput).focus()) should actually set the
focus on the element...

I guess actually it might cause difficulty if another selector type was
used since there may be more than on match.

Jez


-Original Message-
From: Sam Collett [mailto:[EMAIL PROTECTED] 
Sent: 06 November 2006 12:07
To: jQuery Discussion.
Subject: Re: [jQuery] set focus?

On 06/11/06, Jez McKean [EMAIL PROTECTED] wrote:


 I see focus() will run the events tied to an elements onfocus, but how

 can I set the focus.
 (e.g. click button to un-disable a text input, then set the focus on 
 said
 input.)

 Regards,
  Jez

$(#myinput)[0].focus()

Perhaps calling focus ($(#myinput).focus()) should actually set the
focus on the element as well as fire the onfocus event - rather than
just fire the event.



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


[jQuery] Set focus on a text field (newbie question)

2006-08-13 Thread ivan quintero
Sorry for the newbie question, but I want to get rid of my old _javascript_ that I used to set field focus on the first form field, but haven't been able to do it in jquery. How do I do it?--  Ivan Quintero
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Set focus on a text field (newbie question)

2006-08-13 Thread Konstantin Käfer
$('[EMAIL PROTECTED]text]')[0].focus();2006/8/13, ivan quintero [EMAIL PROTECTED]:
Sorry for the newbie question, but I want to get rid of my old _javascript_ that I used to set field focus on the first form field, but haven't been able to do it in jquery. How do I do it?-- 
 Ivan Quintero

___jQuery mailing listdiscuss@jquery.com
http://jquery.com/discuss/
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/