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

  • Home
  • SEARCH
  • 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 3284420
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:09:09+00:00 2026-05-17T20:09:09+00:00

I was working on a dialog with content loaded by AJAX, but I’m not

  • 0

I was working on a dialog with content loaded by AJAX, but I’m not able to remove it.
A must was to have a multiple, php-supported, drag-able and close-able dialog.
(.center() function present)

$('a.event').click(function() {
    var url = this.href;
    var getrel = $(this).attr('rel');
    var getid = $(this).attr('id');
    var dialog = $('<div id="event_'+getid+'" class="izModal '+getrel+'"></div>').appendTo('body');
    dialog.load( url, {}, function (responseText, textStatus, XMLHttpRequest) { $('#event_'+getid+'').append("<a class='close' rel='"+getid+"'>x</a>"); } ).center().draggable();
    return false;
});

And to close it:

        $('a.close').click(function(event){
            var getevent = $(this).attr('rel');
            $('#event_'+getevent+'').hide();
        });

I’ve tried (as you may see) to give every dialog an id to close it.
Also tried with this.parent , hide() , change the CSS and remove().

Can somebody spot the error?
Thanks in advance.

  • 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-17T20:09:10+00:00Added an answer on May 17, 2026 at 8:09 pm

    You’re creating the links dynamically do you need something like a .live() approach, like this:

    $('a.close').live('click', function(event){
      var getevent = $(this).attr('rel');
      $('#event_'+getevent+'').hide();
    });
    

    When using $('a.close').click() you’re finding the elements that exist when it’s run, new elements that are created later won’t have a click handler, .live() resolves this by relying on event bubbling…so it works on elements created later.

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

Sidebar

Related Questions

I have a jQuery dialog which loads an external php page. All is working
I have a working dialog, and i want to change the content during the
I have a dialog that's loaded via ajax. The paylaod of that ajax contains
I'm loading some content into a jquery-ui dialog via .ajax. That's all working fine
I'm trying to have some Ajax form in the page which is not working
Im working on a dialog box in which several rules must be satisfied before
I am trying to use a stage. Stage as Modal Dialog is not working
I have a paragraphed named dialog I am trying to add content to via
I have blinking text modal dialog box and slideshow with jquery. They working just
I've been working on a simple JQuery dialog form that loads in via AJAX.

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.