Use the mouse to detect said events would sound logical to me.  On the focus
trigger, have the script check if the mouse is in the "area" of the object
and if it is assume that it was user triggered and continue, othewise assume
it was a method of the application.

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Klaus Hartl
Sent: Tuesday, April 07, 2009 11:09 PM
To: jQuery (English)
Subject: [jQuery] Re: How to tell apart focus event


In the past I distinguished between true and triggered events via the
e.clientX property (a triggered event has no such property). Not sure
if it's the same with focus events (especially since you're calling
elem.focus and there is no elem.click) and if there is a better way...

--Klaus


On 6 Apr., 04:24, bob <xoxeo...@gmail.com> wrote:
> Hi,
> <form>
>        Name: <input type="text" id="my_name" name="my_name">
> </form>
>
> Is it possible to tell apart focus event?
>
> jQuery("#my_name").focus(function (evt) {
>
>         if( ??? ){
>
>                 //execute this if focus was triggered by user clicking on
the text
> field
>         }
>         else {
>                 //execute this if focus was triggered by method call like
this
>                 //document.getElementById("my_name").focus();
>
>         }
>
> });
>
>

Reply via email to