我有兩個表格。表格1和表格2.我想要將一行內容複製到另一行,而不是點擊該行時,使用java腳本。如何使用javascript將內容從表格的一行移動到另一個表格行
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("t1").clone().appendTo("t2");
});
});
</script>
</head>
<body>
<table style="width:100%;border-style:dashed">
<tr1>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr1>
</table>
</br>
<table style="width:100%;border-style:dashed">
<tr2>
<th></th>
<th></th>
<th></th>
</tr2>
</table>
<button>colne</button>
</body>
</html>
我將理解如果codepen例子進行說明。
你能分享你試過的腳本嗎? –
我在這裏是新的,我不知道如何分享腳本。 –
如果給出codepen示例,我將不勝感激..... –