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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:54:20+00:00 2026-06-18T03:54:20+00:00

Possible Duplicate: How can I detect when a new element has been added to

  • 0

Possible Duplicate:
How can I detect when a new element has been added to the document in jquery?

I have a list of comments in a normal ul element. When loading the page I use something like (the system is based on templates)

<li id="someId">Some Content</li>
<script>doStuffWithLi('someId');</script>

So if the page is loaded and there are some li’s, each one based on the template, there is this block for each li.

Now people can post a new comment and the template and the content is loaded into the page again – but this time the script is not executed. I guess js that is loaded after document ready in general is not executed, ones the document is loaded?

Unfortunately there is no jQuery function like $('li').live('ready', function() {});.
I tried it with the livequery plugin like $('li').livequery(function() {//DO STUFF}); – But this didnt work as well. I cannot simply add a call to the creation of the element, because i can not influence the function adding the comment.

Is it possible to call a function as another li is added?

  • 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-18T03:54:21+00:00Added an answer on June 18, 2026 at 3:54 am

    You could use the event DOMSubtreeModified. Assign this event to the parent of your lis and check if the event gets fired if there is a new li. In this case you assign a new handler to that li.

    $("#li_parent").bind("DOMSubtreeModified", function() {
        alert("possibly a li has been inserted");
        // do your magic here
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Detect if an outgoing call has been answered How can I know
Possible Duplicate: Browser-independent way to detect when image has been loaded How can i
Possible Duplicate: How can I detect the encoding/codepage of a text file I have
Possible Duplicate: How to detect a USB device has been plugged in? I want
Possible Duplicate: How can I detect the encoding/codepage of a text file I've been
Possible Duplicate: How to detect a click outside an element? I have an element
Possible Duplicate: How can I detect if caps lock is toggled in Swing? How
Possible Duplicate: Can I scroll a ScrollView programmatically in Android? I have a chat
Possible Duplicate: Can Read-Only Properties be Implemented in Pure JavaScript? I have an Object
Possible Duplicate: How to detect if a variable is an array I have a

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.