console
$(()=>{
$('input:button').click(()=>{
let name = $("#name").val()
let cls = $("#cls").val()
let score = $("#score").val()
let tr = $('<tr><td>'+ getNum() +'</td><td>' + name + '</td><td>' +
cls + '</td><td>' + score + '</td><td>' +
'<button onclick="del(this)">删除</button></td></tr>' )
$('tbody').append(tr)
})
})
function del(obj)
{
$(obj).parent().parent().remove()
}
function getNum(){
return $('tbody').children().length + 1
}
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<form>
<input id="name" placeholder="姓名"/>
<input id="cls" placeholder="班级"/>
<input id="score" placeholder="成绩"/>
<input type="button" value="添加"/>
</form>
<table border=1 cellspacing=0 cellpadding=5>
<thead>
<tr>
<th>编号</th>
<th>姓名</th>
<th>班级</th>
<th>成绩</th>
<th>操作</th>
</tr>
</thead>
<tbody></tbody>
</table>