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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:24:35+00:00 2026-06-16T07:24:35+00:00

I have this html: <div class=task id=1> Item1 </div> <div class=task id=2> Item2 </div>

  • 0

I have this html:

<div class="task" id="1">
   Item1
</div>
<div class="task" id="2">
   Item2
</div>
<div class="task" id="3">
   Item3
</div>

And JavaScript load subitems. If i click on static item it is working. But if i click on loaded sub items, their subsubitems don`t load.

I created test page to show this: http://helloworld.dimkos.ru/

This code:

$(document).ready(function() {
$('.task').on('click', function(e){
    e.stopPropagation();
    var id = $(this).prop('id');
    var task = $(this);
    $.ajax({
        url: "./sub.php?sub=" + id,
        success: function(html) {
            $(task).append(html);
        }
    });
    return false;
});});

./sub.php?sub=1
append subitems which parent have id
Click on dynamically added subitems is not working.

Solved with $(‘.task’).live(“click”, function(e)

  • 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-16T07:24:37+00:00Added an answer on June 16, 2026 at 7:24 am

    Modify your code like this and test it again:

    $('.task').click(function(e){
        e.stopPropagation();
        var id = $(this).prop('id');
        alert(id);
    });​
    

    See if the first & second case is working or not, FIDDLE 🙂

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

Sidebar

Related Questions

i have html code block like this <div id=some-div> <a href=# class=link-click>some link text</a>
Hi I have this HTML code <th scope=col class= style=width: 13px;> <div class=some-handle></div> <a
I have this html: <div id=signbtn> <a id=login-link class=btnsignin title=Login>Sign in</a> </div> Upon successful
Say I have this HTML: ​<div class = block1>hi</div> <div class = block2>hi</div> And
I have the following Javascript/jQuery function: function addEventHandler(){ $(div).mouseenter(function() { $(this).html(Over); }).mouseleave(function() { $(this).html(Out);
I have this HTML code : <div class=field> <input type=hidden value= name=a id=a> <input
i have this html and css code: <div class=header> </div> .header { top:0; left:0;
I have this jquery code : $(document).ready(function() { $('div.badge_button > .more').click(function() { var id
I'm using jQuery Mobile and I have this html: <ul id=thelist data-corners= false >
Suppose I have the following html: var testString = ' <span id='id'> <div> <table>

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.