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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:51:51+00:00 2026-05-25T15:51:51+00:00

I am loading content from a series of links like this : <div id=tagList

  • 0

I am loading content from a series of links like this :

<div id="tagList" style="display: block;">
  <ul class="post_tags">
    <li id="barrow" class="count-1"><a class="barrow" title="Barrow Tag" href="#Barrow">Barrow</a></li>
    <li id="carnies" class="count-3"><a class="carnies" title="Carnies Tag" href="#Carnies">Carnies</a></li>
    </ul>   
</div>

These then open up a series of images with ajax loading the relevant page, that function looks like this :

    $('#tagList li').each(function() {
        $(this).click(function() {

            var tagName = $(this).attr("id");
            var tagURL = '<?php bloginfo( 'url' );?>/tag/' + tagName;
            var toLoad = '<?php bloginfo( 'url' ); ?>/tag/'+ tagName + ' .tagTable';


            function loadThemTags(){    

            $('#tagThumbs').load(toLoad,hideLoader);
            };

            function hideLoader(){

            $('.tagTable').fadeIn('slow');
            };

            loadThemTags();

        });
 });

The content that is loaded in .tagTable looks like :

<ul id="tagImgBox">         
    <li class="466">
        <div style="display:none" class="466_link">http://foo.com/portfolio/louie</div>
        <img class="tagInfoTrigger" alt="Louie" src="http://foo.com/wp-content/themes/Loupe/scripts/timthumb.php?src=/wp-content/uploads/2011/08/louie.jpg&amp;w=80&amp;h=80&amp;zc=1">
    </li>   
    <li class="418">
        <div style="display:none" class="418_link">http://foo.com/portfolio/devo-and-seigfried</div>
                <img class="tagInfoTrigger" alt="Devo and Seigfried" src="http://foo.com/wp-content/themes/Loupe/scripts/timthumb.php?src=/wp-content/uploads/2011/06/devo_siegfried_2.jpg&amp;w=80&amp;h=80&amp;zc=1">
    </li>
</ul>

I want to work with the link that is printed in the hidden div. I have this script :

$('#tagImgBox li').each(function(){
    $(this).click(function(){
    var uc = $(this).attr('class');
    var uc = uc + "_link";
    var up = $('.' + uc).html();
    alert (up);
    });
});

which works if I navigate straight to the /tag/ page. But if I access the ajax loaded .tagTable they do not work. Nothing happens, even break points are ignored. It is as if #tagImgBox li does not exist but I can see the id is there when pulled through the ajax.

Hope my question makes sense and thanks for any help!

  • 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-25T15:51:52+00:00Added an answer on May 25, 2026 at 3:51 pm

    You need to use .live() instead of .click().

    The code you have now only attaches the click handler to the selected elements when you run it. What you want to do is have the click handler attached to all elements that match no matter when they show up (so, this means things that are loaded via AJAX after the page has finished loading initially).

    Here’s the code you should use:

    $('#tagImgBox li').live("click", function(){
        var uc = $(this).attr('class');
        var uc = uc + "_link";
        var up = $('.' + uc).html();
        alert (up);
        });
    });
    

    You also don’t need .each() (using .live() or .click()) because event handlers will attach to each selected element by default. In fact, most jQuery methods behave this way.

    By using .live(), you will be able to load elements that match and have the handler attach to them automatically.

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

Sidebar

Related Questions

On my website, I am loading the content dynamically from database like this e.g
After loading dynamic content to a DIV, I'd like to add a Close option,
I'm creating a div with jquery, loading content from webserver with load, and then
I'm dynamically loading different content from db, using ajax. So, when I'm loading plain
I'm loading html content via ajax onto a div (using mootools 1.11 and squeezebox,
Currently I have a webform that has a series of links. What I'd like
I am having some strange problems loading content from another XHTML page via jQuery.
Iam having a bit of a trouble loading content to CKeditor from within Jquery.
Is it possible to load content from an external page (not relative) into div
Using JQuery, I am loading a div from an external HTML page into fancybox

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.