我想在html表格中追加表格标题。在jQuery中追加表格标题
它的追加,但它插入一个休息和追加在下一行。如何克服这一点?
Plz help。提前致谢。检查我的代码如下
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
</head>
<body>
<table id="test">
<thead>
<th> Column 1</th>
<th> Column 2</th>
<th> Column 3</th>
</thead>
</table>
<button> Click Me</button>
<script>
$('#test >thead').append('<th> Column 4</th>');
</script>
</body>
</html>
你缺少你的HTML的TR。 –
@JenniferGoncalves IT'S BROWSER自动将它们引入OP的代码。我仍然在我的理由部分 –
现在这是正确的。 –