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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:16:33+00:00 2026-05-11T01:16:33+00:00

I am inserting the HTML response from an AJAX call into my page, but

  • 0

I am inserting the HTML response from an AJAX call into my page, but then when I try to access those elements after they have been created, it fails..

This is how i retrieve and insert the HTML:

$.ajax({url: 'output.aspx',    data: 'id=5',     type: 'get',     datatype: 'html',    success: function(outData) {$('#my_container').html(outData);}  }) 

The outcome HTML, which is inserted into the <div> (id = my_container) looks like:

<div id='my_container'>    <ul>       <li id='578' class='notselected'>milk</li>       <li id='579' class='notselected'>ice cream</li>       <li id='580' class='selected'>chewing gum</li>    </ul> </div> 

…and afterwards, when I try to access any of the <li> elements using queries like: $('#my_container li:first') or $('#my_container ul:first-child') or similar, nothing gets selected.

I am using the Listen plugin to detect any click events on the <li>elements and it works… But i couldn’t figure out how to detect if the div is populated with the output HTML and accordingly change one of the <li>‘s class for example…

$(document).ready does not work either…

Imagine I need to change the css style of the second <li>.. what is the solution to this?

  • 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. 2026-05-11T01:16:33+00:00Added an answer on May 11, 2026 at 1:16 am

    How are you checking to see whether your AJAX call has completed? Because it’s asynchronous, the elements will not, of course, be available to the code which executes immediately after your $.ajax(…) call.

    Try manipulating those elements from within the success function or in other code which is called from there — at that point, you will know that the content is available.

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

Sidebar

Ask A Question

Stats

  • Questions 69k
  • Answers 69k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Try raw in lowercase: ${stacktrace:format=raw} If that doesn't work try:… May 11, 2026 at 12:43 pm
  • added an answer Since you say you don't touch sound in your programs,… May 11, 2026 at 12:43 pm
  • added an answer Nope, there's no way to do this. Even from an… May 11, 2026 at 12:43 pm

Related Questions

Basically I am inserting an image using the listviews inserting event, trying to resize
I am using the django framework and am using templates, inheriting a lot of
I am inserting a column in a DataGridView programmatically (i.e., not bound to any
If I am inserting elements into a wrap panel and there is still space
Bearing in mind this is for classic asp Which is better, all HTML contained
I just switched two projects over to fogbugz and so far I like it
Currently I am binding a dataset with a datagrid. ds = query.ExecuteReadQuery(select PollQuestionText as
What is the way of separating Line-Breaks and Space in MultiLine Textbox or HTML

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.