diff --git a/app/static/split_line.js b/app/static/split_line.js index 18c9ca5..66ee4e7 100644 --- a/app/static/split_line.js +++ b/app/static/split_line.js @@ -1,25 +1,27 @@ const addLineButton = document.getElementById("add-line-button"); const lineContainer = document.getElementById('table-body'); +var counter = 1; function addLine(){ const columns = ['Amount', 'Vendor', 'Confirmation Code', 'Note']; var tr = document.createElement('tr'); - var counter = 2; columns.forEach(column => { var td = document.createElement('td'); var ip = document.createElement('input'); ip.type = 'text' ip.classList = 'form-control' - ip.name = `${column}-${counter++}` + ip.name = `${column}-${counter}` ip.placeholder = column td.appendChild(ip) tr.appendChild(td) }) + counter++ lineContainer.appendChild(tr) } document.addEventListener('DOMContentLoaded', () => { + addLine() addLineButton.addEventListener('click', addLine) }) \ No newline at end of file diff --git a/app/templates/split_line.html b/app/templates/split_line.html index f435f08..047a3ef 100644 --- a/app/templates/split_line.html +++ b/app/templates/split_line.html @@ -37,14 +37,7 @@
| - | - | - | - |