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

The Archive Base Latest Questions

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

I created rows of table Dynamically by jquery, I also add a remove button

  • 0

I created rows of table Dynamically by jquery, I also add a remove button on each row,and add an event on this button by which the row corresponding to that button(in a row) is removed when we click on that button,But my broblem is only upper three buttons are active and fired,and the buttons which are at last are not able to work.

$(function(){ 
    $('<input></input>')
        .attr({'type': 'button'})
        .val("Remove")
        .appendTo('table#AllSelectedTest tbody tr:first td:last')
    ; 
});

$(document).ready(function() { 
    $("table#AllSelectedTest tbody tr input").live({
        click: function(){
            $(this).closest('tr').remove(); 
        }
    })
});

I uses The above code For Generating a button and bind it with the events.
My Problem is some button works and some are not

  • 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-28T12:57:24+00:00Added an answer on May 28, 2026 at 12:57 pm

    its always good to give an id to element. try changing the code as below

    $(document).ready(function(){   
       $('<input>').attr({type: 'button', id:"remove_button", value:'Remove'})
                         .appendTo('table#AllSelectedTest tbody tr:first td:last');
    
       $("#remove_button").live("click", function(){
                             $(this).closest('tr').remove();
            });
    });
    

    fiddle example : http://jsfiddle.net/vSUYj/1/

    also if you are using jquery above 1.7, please make use on instead of live.

    update: try this as well, in case above not working

     $(document).ready(function(){   
           var elem = $('table#AllSelectedTest tbody tr:first td:last');
           elem.append('<input type="button" id="remove_button" value="Remove"/>');
    
         $("#remove_button").live("click", function(){
             $(this).closest('tr').remove();
         });
     });
    

    fiddle example : http://jsfiddle.net/vSUYj/

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

Sidebar

Related Questions

$(#tableid tbody:last).append(html); This creates table rows dynamically. Each newly created row has a remove
I have a table which has a button to Add Rows. This button adds
in my app, i have created table rows dynamically in each table row, i
I have a jsp page in which rows are created dynamically to a table
I am dynamically creating a table which places a dynamically created radiobuttonlist in each
I have been researching the JQuery way to add table rows dynamically. One excellent
I have two columns in my table and the rows are created dynamically. <table
My sql table is something like (message,created) I want to select those rows which
In a form a text box is created dynamically by clicking on add button
I am having a table in which i`m dynamically creating and deleting rows. How

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.