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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:58:37+00:00 2026-05-22T14:58:37+00:00

I have a select list input that allow user to select multiple item. Upon

  • 0

I have a select list input that allow user to select multiple item. Upon selection, it will dynamically create a new li item in my ordered list as in the HTML code below.

HTML

<ol class="asmList3" id="multiol">
   <li rel="multioption1" class="asmListItem2" style="height: 20px; ">
      <span class="asmListItemLabel2">Acrylic</span>
      <a href="#" class="liRemoveItem">X</a>
   </li>
</ol>

Script

$('.liRemoveItem').click(function(){
   alert("X is clicked");
   //remove child li
});

Supposely on clicking on the X which has the class liRemoveItem, I wish to remove the child li but the class is not even working for a simple alert. I think it is because the child li was created dynamically.

If the li was added in the HTML when loaded and not dynamically created, the class liRemoveItem works. Can someone please give me a hint as to what I did wrong? Thank you.

  • 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-22T14:58:38+00:00Added an answer on May 22, 2026 at 2:58 pm

    use the jQuery live method

    Attach a handler to the event for all elements which match the current selector, now and in the future.

       $('.liRemoveItem').live("click",function(){    
          alert("X is clicked");    //remove child li 
       });
    

    The .live() method is able to affect elements that have not yet been added to the DOM through the use of event delegation: a handler bound to an ancestor element is responsible for events that are triggered on its descendants. The handler passed to .live() is never bound to an element; instead, .live() binds a special handler to the root of the DOM tree

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

Sidebar

Related Questions

I have a routine that dynamically changes a select list's selected option when the
I have a select box that gets generated dynamically. I want to allow users
I have a button on a form that is dynamically spawning a select list,
I have a form with some select lists that will show/hide more input fields
I have a table with multiple rows in each row is a select list
I want to have a select-only ComboBox that provides a list of items for
I have a select box that gets cloned. I want to remove the user's
I have a select field that is dynamically populated with an ajax call that
Okay, right now I have a form that contains this select list: <%=Html.LabelFor(x =>
i have an input that generates a positioned unordered list when someone enters 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.