This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Need help determining when a jQuery Tools overlay has been closed (not working in FF) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Need help determining when a jQuery Tools overlay has been closed (not working in FF)" Watch "Need help determining when a jQuery Tools overlay has been closed (not working in FF)" New topic
Author

Need help determining when a jQuery Tools overlay has been closed (not working in FF)

Rob Dennett
Ranch Hand

Joined: Dec 07, 2010
Posts: 81
I am using a jQuery Tools overlay to present a dialog box to the user. If the user clicks on the close button, I need to trigger an event noting that fact. The code I wrote to do it works in Chrome and IE, but fails in Firefox on both Mac and Windows.

(the onClose property is part of the object I use to initialize the overlay)



In Firefox, e.srcElement is undefined. So is e.originalTarget. Does anyone know of a workaround for this issue?

Thanks, Rob
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63232
    
  69

srcElement is non-standard. Try e.target.

(You have no excuse -- I know you have my book! )


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rob Dennett
Ranch Hand

Joined: Dec 07, 2010
Posts: 81
e.target doesn't work. It contains the overlay object itself. I need to get a handle to the closing element. Failing that, I need to figure out that the overlay dialog was cancelled as opposed to accepted.

Thanks,
Rob
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63232
    
  69

What is the function context (this) set to?
Rob Dennett
Ranch Hand

Joined: Dec 07, 2010
Posts: 81
It also contains the overlay object.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63232
    
  69

Wow, that's one screwed up widget that's not following any of the conventions.

If I come with any other brought ideas (short of chaining the widget code), I'll chime in again.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63232
    
  69

A quick look at the docs and it looks they may be setting the real target into e.originalTarget... try that.

(If my eyes were rolling any harder, I'd injure myself.)
Rob Dennett
Ranch Hand

Joined: Dec 07, 2010
Posts: 81
e.originalTarget is undefined, but e.originalEvent.originalTarget has the closing element.

Rob
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63232
    
  69

So much for standards and conventions!

Glad you found what you needed.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Need help determining when a jQuery Tools overlay has been closed (not working in FF)
 
It's not a secret anymore!