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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:06:37+00:00 2026-06-04T08:06:37+00:00

I have a list whose li are generated dynamicaly via AJAX: <ul> <li id=hello></li>

  • 0

I have a list whose li are generated dynamicaly via AJAX:

<ul>
  <li id="hello"></li>
  <li id="world"></li>
  <li id="helloWorld"></li>
</ul>

I also have a global var in my script like this:

var world = 'world';

I want, on document ready, as soon as the list gets loaded, to find the li item with the same id as my global var:

$('ul').find('#' + world);

I can’t use a conventional .on() event listener here since there is no other event to trigger it, except for the end of the loading itself.

So my next step was to trigger a custom event in my loading script:

$('ul').trigger('loadingDone');

And then listen for it:

$('ul').one('loadingDone', theFunctionThatDoesTheSearch );

Problem is, this failed and it completely ignored any of the generated elements.

I know that a possible solution would be to run these operations inside the success method of the ajax call, but the current architecture of the app I’m building doesn’t allow for that. (I can and do trigger the event inside the success AJAX method, I just cant do the search there)

Basically what I am asking for are alternative solutions for allowing the loading script to let me know when it is done and ways to filter trough the generated content without doing the filtering inside the loading script itself.

  • 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-06-04T08:06:39+00:00Added an answer on June 4, 2026 at 8:06 am
    $(document).on("customevent","ul",function(){
    console.log("event triggered from inside the ajax success handler");
    });
    
    $.ajax({
        url:'/echo/json/',
        success:function(){
        $('div').append("<ul><li>asd</li></ul>");
            $("ul").trigger("customevent");
        }
    });
    

    http://jsfiddle.net/xp7sr/2/

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

Sidebar

Related Questions

I have a panel whose items are a list and a panel like below
I have a listbox whose values are generated dynamically. The list box contains months
I have dynamically generated a list of wine types from the database using AJAx
I have a list of objects.Every object has an attribute priority whose value could
In my application, I have a listview whose list item consists of a TextView
I have a WinForms .NET datagrid whose data source is a List<cLineItem> called lines.
I have one wordpress blog whose home page is showing a list of 10
I have a DataGridViewComboBoxCell, whose DataSource is a List. When an item is selected
Good Afternoon, I have a list being generated gradually on the users screen, (right
I have an issue concerning constraints which should be generated dynamically from a list

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.