Eigentlich möchte ich die überprüften Zeilen von der Tabelle eines div (Tabelle 1) in die Tabelle eines anderen div (Tabelle 2) kopieren. Aber mit dem unten stehenden Skript, wenn ich mehr als ein Kontrollkästchen ankreuze, wird die erste überprüfte Zeile durch die zuletzt geprüfte Zeile ersetzt. Aber ich möchte, dass jede überprüfte Zeile der Tabelle 1 nacheinander in Tabelle 2 erscheint.Kopieren Geprüfte Zeilen von einer Tabelle in eine andere Tabelle
Jede Hilfe wird geschätzt. Danke im Voraus!!!
HTML
<div class="form-group" id="jqcc" >
<table id="order-table" name="order-table">
<tr>
<th>Select</th>
<th>Medication</th>
<th>Max Issue Limit</th>
</tr>
<tbody></tbody>
</table>
</div>
Javascript
<script>
var tableControl = document.getElementById('order-table');
$('#jqcc').click(function() {
var result = []
var x1;
var tab;
var count = document.querySelectorAll('input[type="checkbox"]:checked').length;
$('input:checkbox:checked', tableControl).each(function() {
result.push($(this).parent().next().text() + "," + "<br>"); // refers title of product
$(this).closest('tr').find('input').each(function() {
x1 = $(this).val(); // refers price of product
})
tab = "<tr><td>" + result + "</td>";
tab += "<td>" + x1 + "</td>";
tab += "<td>" + x1 + " </td>";
tab += "<td><button type='button' onclick='deletePerson(this);' class='btn btn-default'> <span class='glyphicon glyphicon-remove' /></button></td>";
tab += "</tr>";
tab += "</tbody>"
$("#charges").html("<table id='peopleTable' class='table table-bordered table-condensed table-striped'><thead><tr><th>Description</th><th>Actual Amount</th> <th>Claim Amount</th> <th></th></tr></thead>" + tab + "</table>").show();
});
});
</script>
können Sie Ihren HTML-Code bitte hinzufügen –