“Removendo linha específica com botão HTML” Respostas de código

Remova o botão da linha da tabela HTML usando JavaScript

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

Removendo linha específica com botão HTML

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

Removendo linha específica com botão HTML

<!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>
Real Ray

Respostas semelhantes a “Removendo linha específica com botão HTML”

Perguntas semelhantes a “Removendo linha específica com botão HTML”

Mais respostas relacionadas para “Removendo linha específica com botão HTML” em HTML

Procure respostas de código populares por idioma

Procurar outros idiomas de código