我的网页中有一个表格,该表格由一个表格组成,该表格中包含一个嵌套表格。当我尝试克隆嵌套表的行时,这些行没有被克隆。但是,克隆对于外部表工作正常。这是我的 HTML 代码
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<div id="division">
<form class="allergyrow">
<table id="tab" border="1">
<thead>
<tr>
<th scope="col">Remove</th>
<th scope="col">Allergy</th>
<th scope="col">Reaction</th>
<th scope="col">Adverse Event Date</th>
<th scope="col">Comment</th>
</tr>
</thead>
<tbody>
<tr class="datarow">
<td><input type = "checkbox" id = "remove" class="remove" value = "Remove" /></td>
<td><input type = "text" id = "myText" class="myText" /></td>
<td >
<div>
<table id="inner" class="inner">
<tbody>
<tr id="innerrow" class="innerrow">
<td>
<select id = "myList" class="myList">
<option value = "1">Rashes</option>
<option value = "2">Shock</option>
<option value = "3">Asthma</option>
<option value = "4">Nausea</option>
<option value = "5">Anemia</option>
<option value = "6">Unknown/Other</option>
</select>
</td>
<td>
<select id = "reaction" class="reaction">
<option>Yes</option>
<option>Mild</option>
<option>Moderate</option>
<option>severe</option>
</select>
</td>
<td>
<button id="plus" class="plus">plus</button>
</td>
</tr>
</tbody>
</table>
</div>
</td>
<td><input type="date" id="eventdate" class="eventdate"/></td>
<td><input type="text" id="comment" class="comment"/></td>
</tbody>
</table>
</form>
<button id="submit">Submit</button>
</div>
这是我用来克隆内表行的 Jquery 代码
$("#plus").click(function(){
var row=$("#innerrow");
row.clone().appendTo("#inner");
s
});
但是 JQuery 代码似乎不起作用,当我调试时,我可以看到正在创建克隆的行,然后它们消失了。谢谢你。