Hmmm...that hasn't come up for me yet. Seems like the way you're doing it would be the way to go for now.

Maybe in the next jQuery version they could add a key "internalTrigger" or something like that to the event object when the trigger method is run.

-- Josh

----- Original Message ----- From: "Dan G. Switzer, II" <[EMAIL PROTECTED]>
To: <jquery-en@googlegroups.com>
Sent: Monday, June 30, 2008 3:26 PM
Subject: [jQuery] Best way to detect between jQuery triggered event and actual browser-based event...



Just curious as to everyone's recommendations on detecting the difference
between a jQuery created event object (i.e. $("#el").trigger("click")) and a
real event object (i.e. create by the browser.)

Right now I'm doing:

if( !("ctrlKey" in e) )

I believe the ctrlKey should be sent by every browser when the event action occurs via a user's action, but just wanted to know if there's a better way.

It would be really nice if jQuery would pass a key that indicates whether an
event object is generated by the browser or by jQuery. I've come across a
few occasions were I needed to do different things based on how the event
was being triggered.

-Dan


Reply via email to