1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| <!DOCTYPE html>
<html lang="fr" dir="ltr">
<head>
<meta http-equiv="cache-control" content="public, max-age=60">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="Daniel Hagnoul">
<title>Test</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/le-frog/jquery-ui.min.css">
<style>
th, td {
margin: 6px;
padding: 3px;
width: 200px;
height: 80px;
border: 1px dotted grey;
}
</style>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/i18n/jquery-ui-i18n.min.js"></script>
<script>
'use strict';
$( function(){
$( '#copy' ).on( 'click', function( ev ){
let tbody = $( '#myTable > tbody' );
tbody.find( 'tr' ).eq( 0 ).clone( true, true ).appendTo( tbody );
});
});
</script>
</head>
<body>
<button id="copy">Copy</button>
<table id="myTable">
<thead>
<tr>
<th class="labelDesignation">Désignation</th>
<th class="labelReference">Référence</th>
<th class="labelQuantite">Quantité</th>
<th class="labelCode">Code</th>
</tr>
</thead>
<tbody>
<tr>
<td class="caseDesignation">designation</td>
<td class="caseReference">reference</td>
<td class="caseQuantite">quantite</td>
<td class="caseCode">code</td>
</tr>
</tbody>
</table>
</body>
</html> |