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 7080225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:46:08+00:00 2026-05-28T06:46:08+00:00

I have a dom object that is loaded via $.load(). I then have click

  • 0

I have a dom object that is loaded via $.load(). I then have click functions connected to the object that is loaded.

The click functions won’t fire with the new DOM object.

What am I missing?

nothing in the .cntrls a click function is firing.

Here’s a sample:

    $('.ati a').click(function() {

    // First, clear out the current content
    if ('.msg-obj' || '.poc-obj' || '.pom-obj || .cntrls') {
        $('.msg-obj, .poc-obj, .pom-obj, .cntrls').hide();
    };

    // Get the URL for the object that is clicked
    var clickedObjPath = $(this).attr('href');

    console.log(clickedObjPath);

    $('#msg').load(clickedObjPath + ' .msg-obj').fadeIn();
    $('.poc').load(clickedObjPath + ' .poc-obj').fadeIn();
    $('.pom').load(clickedObjPath + ' .pom-obj').fadeIn();
    $('.cntrls').load(clickedObjPath + ' .cntrls a').fadeIn();

    return false;
});


$('.cntrls a ').click(function() {

    // Get the URL for the object that is clicked
    var cntrlObjPath = $(this).attr('href');
    console.log(cntrlObjPath);

    return false;

});
  • 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-28T06:46:08+00:00Added an answer on May 28, 2026 at 6:46 am

    If you install the click handlers before the object actually exists in the page, they won’t work unless you use delegated event handling. The code will look for the desired object to hook up its event handler and won’t find it so nothing will be hooked up.

    In jQuery before 1.7, you would use .delegate() and in jQuery 1.7+, you would use .on() on a parent object that does exist at the time you install the click handlers.

    Using .on() (for jQuery 1.7+), you would do it like this:

    $(document.body).on('click', '.ati a', function() {...});
    

    Ideally, you’d pick a parent object that was closer to the actual object than the body object and exists at the time you install the click handler, but you haven’t included any of your HTML so I don’t know what to be pick besides body.

    The pre-jQuery 1.7 syntax would be this:

    $(document.body).delegate('.ati a', 'click', function() {...});
    

    The old way to do this was using .live(), but that has been deprecated for all versions of jQuery and they recommend .delegate() for pre-jQuery 1.7 or .on() for jQuery 1.7+.

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

Sidebar

Related Questions

I have a DOM object with loaded HTML markup. I'm trying to replace all
Let's say that I have a DOM object: var a = document.getElementById('parent') I want
I'm new to PHP DOM object and have a problem I can't find a
I have built a dom object Engine that has private/public fields/methods that I have
I have a org.w3c.dom.Node object. I would like to see if it has any
I have found this question; Can I move a Flash object within the DOM
I have a DOM element in memory that is yet to be injected in
So I have a DOM document that looks essentially like this <categories> <category id=1/>
I have a XML org.w3c.dom.Document object. It looks sorta like this: <A> <B> <C/>
I have a problem with a php DOM Object http://php.net/manual/en/class.domdocument.php Is it possible only

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.