Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4064380
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:50:54+00:00 2026-05-20T15:50:54+00:00

I am trying to bind an event to all dialogs that have been created

  • 0

I am trying to bind an event to all dialogs that have been created on a page using the JQuery UI Dialog function (whether they have been displayed or not). I can’t seem to figure out a selector that will get me there. I’ve tried both .ui-dialog and .ui-dialog-content without success.

Since I’m trying to make a generic method, I won’t know the IDs of the dialogs that may have been created.

I’m using the following code to test. It works if I specify a dialog’s id (#mydialog), but in production, I won’t know these.

$("div.ui-dialog").bind("dialogclose", function(event, ui) {
  window.alert("close fired");
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T15:50:55+00:00Added an answer on May 20, 2026 at 3:50 pm

    Do your dialogs have a common class that you can select them with? If they all have the “ui-dialog” class then this will work:

    $(".ui-dialog")
    

    Your example of

    $("div.ui-dialog")
    

    Is asking to select all divs with a class of ui-dialog, which should probably also work as long as the class is given to a div element.

    Your problem might be that you binding the dialog elements before they exist? You might want the .live() function instead so that it binds to any dialogs created at any point and not just the ones that exist when the function is called.

    Posting an HTML snippet would help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am trying to bind an event to a dynamically created div. function GameField(playerNumber)
I'm using jQuery to bind to all links on the page (I'm using the
I have a page with a div that is dynamically filled using a paginator
I have a page that uses the JQuery Listnav plugin ( http://www.ihwy.com/labs/jquery-listnav-plugin.aspx ). The
I am trying to bind an event to a method of a particular instance
I'm trying to bind an onChange event to 7 dropdowns inside a loop. But
I am getting strange behaviour when trying to upload files, using jQuery multi-file plugin,
I am trying to bind a simple click event to an the selected option
I have several dynamically created links and forms on one page named with IDs
I have several select lists on a page. They are all named in array-fashion

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.