I want to clone my tr class row. So when the user is clicking at a button, the row will clone and will set below the last row.
I currently use the following code, only it will not work properly. I probably not be correct.
JS:
var row = jQuery('.ui-sortable').closest('.ui-sortable').find('tbody tr.row.ui-sortable:last-child');
var clone = row.clone();
The cloned field looks like this:
HTML markup:
echo '<tbody class="ui-sortable">';
echo '<tr class="row">';
echo '<td class="order">1</td>';
// Do some stuff inside the row.
echo '<td class="remove"><a class="repeatable-remove button" href="#">-</a></td>';
echo '</tr>'; // End .row
echo '</tbody>';
I think that the first snippet of code at the javascript is not correctly.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…