Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
- <table id="produse">
- <tr>
- <th width="20%">Produs</th>
- <th width="10%">Cantitate</th>
- </tr>
- <tr id="0">
- <td contenteditable="true">Produs</td><td contenteditable="true">0</td>
- </tr>
- <tr><td></td><td><input id="add" type="button" value="Add" style="float: right;" /></td></tr>
- </table>
- <style>
- table#produse {
- width: 30%;
- background: repeat;
- border: 1px solid;
- }
- table#produse tr td[contenteditable="true"] {
- border: 1px solid #000;
- }
- </style>
- <script type="text/javascript">
- $(document).on("click", "#add", function() {
- var table = document.getElementById('produse'),
- count = $('tr[id]', table).attr('id');
- var row = '<tr id="'+ count+1 +'"><td contenteditable="true">Nume Produs</td><td contenteditable="true">Cantitate</td></tr>';
- $('tr[id]:last', table).after(row);
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment