I want to add a row below another but it is added at the end.
<html>
<head>
<meta charset="UTF-8" />
</head>
<body>
<table style="width: 200px" border="1">
<tr>
<th style="width: 100px">A</th>
<th style="width: 100px">B</th>
</tr>
<tr id="info">
<td>Data1</td>
<td>Data2</td>
</tr>
<tr>
<th colspan="2">C</th>
</tr>
</table>
<br />
<button type="button" onclick="AddRow()">Add Row</button>
</body>
</html>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
function AddRow() {
$('#info').parent().append('<tr><td>Data3</td><td>Data4</td></tr>');
}
</script>
I would like it to be added as follows. Is there a way to achieve this?
