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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:04:12+00:00 2026-06-02T15:04:12+00:00

I have a table with rows in it. When I click a button it

  • 0

I have a table with rows in it. When I click a button it is removes the row prior to it. I am using the closest() function to determine the row. I would like to delete the same row that the button is in.

function DeletClick(id, date) {
    var e = window.event; \
    if (confirm('Are you sure you want to delete the record from ' + date + '?')) {
        DisplayInformation.Delete(id,
           function (result) {
               if (result) {
                   jQuery('#' + e.srcElement.id).closest('tr').remove(); //Delete Row here!
               } else {
                   alert('You Do not have permssion to delete record.');
               }
           });
    }
   }
  • 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-02T15:04:14+00:00Added an answer on June 2, 2026 at 3:04 pm

    If the button is inside the td of the specific row, then you can use the same logic to determine the current row,

    $(this).closest('tr').remove();
    

    Assuming DeletClick function is the click handler for the delete button.

    In case if you have binding the event handler inline of the button HTML like below then you need to pass the this as an arg to the function and update the this in the above code with that argument.

    <input type="button" value="Delete" onclick="DeletClick('someid', 'somedata', this)" />
    

    Then inside the function,

    function DeletClick(id, date, thisObj) {
        var e = window.event; \
        if (confirm('Are you sure you want to delete the record from ' + date + '?')) {
            DisplayInformation.Delete(id,
               function (result) {
                   if (result) {
                       jQuery(thisObj).closest('tr').remove(); //Delete Row here!
                   } else {
                       alert('You Do not have permssion to delete record.');
                   }
               });
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table with multiple rows, with each row having a button within
I have an HTML table with various rows, each has a delete button with
Problem: When I click the delete button for a given table/section row, i get
I have created new rows using Javascript function addRow(id) , but I can't delete
how remove html table rows after 2nd row? if in table have 5 row,
I have table of 5000+ rows and 8+ columns like, Station Lat Long Date
I have table with few rows, after use hover mouse over row I want
I have a table with rows having duplicate userId's. I am trying to delete
On my pages I have a table with rows that typically look like this:
I have a table with multiple rows. Each row is a form. I want

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.