From: Mischa POSLAWSKY Date: Sat, 13 Jun 2020 14:32:25 +0000 (+0200) Subject: word edit: js appends more multiinput columns X-Git-Tag: v1.13~218 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/d3cde7d7d6e880f60843735dea7cea555edfe62b word edit: js appends more multiinput columns Enter multiple option without requiring intermedia saves. --- diff --git a/writer.js b/writer.js index f05559f..3f97e41 100644 --- a/writer.js +++ b/writer.js @@ -1,4 +1,16 @@ document.addEventListener('DOMContentLoaded', () => { + document.querySelectorAll('.multiinput > input[id]').forEach(el => { + el.oninput = e => { + if (e.target.value == '') return; + let add = e.target.cloneNode(true); + add.value = ''; + add.oninput = e.target.oninput; + e.target.parentNode.appendChild(add); + e.target.oninput = undefined; + e.target.removeAttribute('id'); + }; + }); + let wpinput = document.getElementById('wptitle'); if (wpinput) { let wpbutton = wpinput.parentNode.appendChild(document.createElement('button'));