Dies ist der HTML- und Jquery-Code für die Funktion. Es initialisiert die erste Zeile, also möchte ich jetzt die versteckte Zeile aufrufen, wenn ich auf die Schaltfläche klicke, so oft ich mit der gleichen Schaltfläche kann. Hier ist mein Code so weitWie füge ich eine versteckte Zeile mit einem onclick in eine Tabelle ein, kontinuierlich in Jquery
<!-- Jquery button click function -->
$(function() {
$('button').click(function() {
$('#other_tr').show()
var clone = $('#other_tr').clone;
$('#first_tr').after(clone)
})
});
<html>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table>
<thead>
<tr id="first_tr">
\t \t \t <th>Unit price</th>
\t \t \t <th>Discount</th>
\t \t \t <th>Total</th>
\t \t \t </tr>
<!-- hidden row -->
<tr id="other_tr" style="display: none;">
\t \t \t <th>Unit price</th>
\t \t \t <th>Discount</th>
\t \t \t <th>Total</th>
\t \t \t </tr>
</thead>
</table>
<button>Fetch Row</button>
</body>
</html>