removing specific row with button html

// JQuery solution!
$('table').on('click', 'input[type="button"]', function(e){
   $(this).closest('tr').remove()
})

4.2
5
AllInOne 95 points

                                    function deleteRow(r) {
    var i = r.parentNode.parentNode.rowIndex;
    document.getElementById("myTable").deleteRow(i);
}

4.2 (5 Votes)
0
4
2
Bretsky 95 points

                                    <!DOCTYPE html>
<html>
<head>
<style>
table, td {
    border: 1px solid black;
}
</style>
</head>
<body>

<table id="myTable">

<tr>
  <td>Row 1</td>
  <td><input type="button" value="Delete" onclick="deleteRow(this)"></td>
</tr>
<tr>
  <td>Row 2</td>
  <td><input type="button" value="Delete" onclick="deleteRow(this)"></td>
</tr>
<tr>
  <td>Row 3</td>
  <td><input type="button" value="Delete" onclick="deleteRow(this)"></td>
</tr>
</table>
</body>
</html>

4 (2 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
remove table line button html using javascript how to make delete row buttons remove row using button simple row button delete javascript onclick remove row jscript how to remove a table row in html how to delete element from table in javascript onclic show table on click remove table typescript implement remove button from table js remove table row html table buttons taken out row delete in javascript javascript table on button delete click remove tr how to pass a table row delete method inside <a>tag or button how to delete table row on button click in javascript how to add clear table function to button in javascript javascript delete table row'' onclick how to remove row from table in javascript table delete and add row function html css html delete table row select row to delete html javascript remove table how to remove the ro0w click remove in javascript delete selected row in html table using javascript delete selected row from table html javascript delete row on button click javascript delete button for table on press delete key delete table row in html how to remove table row javascript removing specific row with button html clearing a specific row with button html how to drp a row in table jtml onclick delete table row with input field data onclick delete table row with data javascript clearing a table with a button button to delete row js delete button to delete the row js delete button to delete the row remove tr in javascript remove table row on button click javascript how to delete a table in dom onclick javascript remove table row javascript
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source