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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:24:23+00:00 2026-05-28T01:24:23+00:00

I have HTML: <button id=’pusher’>pusher</button> <ul id=sortable> <li>things here</li> </ul> And JavaScript: $(.del).click(function(e) {

  • 0

I have HTML:

<button id='pusher'>pusher</button>

<ul id="sortable">
    <li>things here</li>
</ul>

And JavaScript:

$(".del").click(function(e) {
    $(this).parent().remove();
});


$("#pusher").click(function(e) {
    var text = "test";
    var lix = $("<li class='uix' />").text(text);
    lix.append($('<button class="del">xx</button>'));
    lix.appendTo($("#sortable"));
});

I’m trying to make the pusher button make new <li> elements with a delete button inside, then when delete button is pressed it deletes its <li> element…

But it is not deleting.

Any ideas?

  • 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-28T01:24:24+00:00Added an answer on May 28, 2026 at 1:24 am
    $(".del").click(function(e) {
    

    This only binds to .del elements that exist when it’s ran. You want to use .live.

    $(".del").live('click', function(e) {
        $(this).parent().remove();
    });
    

    This will bind the event to the element, no matter when it was added.

    EDIT: It seems .live is deprecated, try using .on instead.

    $(document).on('click', '.del', function(e) {
        $(this).parent().remove();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JavaScript function for a HTML button click event in aspx page
This is probably a basic html/css question... I have a simple one-button form that
This is pretty noob question, if I have an html button: and when the
I have a HTML button like <input type=button id=button onclick=showSuper() value=Click Me! /> Inside
I have html like this: <html> <input type='button' name='button1' id='button1'> <input type='button' name='button2' id='button2'>
hope you can help me. I have html markup like this: <a href=error.htm class=button
How do I insert PHP code into a HTML Button? Here's what I have:
I have an html button which is really just this: <div onClick=window.location.href=somePage.htm> <img src=img.png/>
I have a site that has a simple HTML button in a form. All
I have ASP.Net code generating my button's HTML for me using divs to get

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.