diff options
author | Tom Smeding <tom@tomsmeding.com> | 2022-09-05 20:57:23 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2022-09-05 20:57:23 +0200 |
commit | c9eb038d8145b5aecd680932243c3720294be842 (patch) | |
tree | cd9edab8e99367145bd60aea8467b0021aef35b9 /static/index.js | |
parent | 769aa87afb4b764021aa769956bcd000408ce5ca (diff) |
Move input box to top
Diffstat (limited to 'static/index.js')
-rw-r--r-- | static/index.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/static/index.js b/static/index.js index ca76f1e..1f98336 100644 --- a/static/index.js +++ b/static/index.js @@ -100,12 +100,6 @@ function initialiseList() { var el_item, el; el_list.innerHTML = ""; - for (var i = 0; i < glist.length; i++) { - el_item = createItemElement(glist[i][0], glist[i][1]); - glist[i][2] = el_item; - el_list.appendChild(el_item); - } - el_item = document.createElement("div"); el_item.classList.add("item"); el_item.classList.add("make-new"); @@ -129,6 +123,12 @@ function initialiseList() { el_item.appendChild(el); el_list.appendChild(el_item); + + for (var i = 0; i < glist.length; i++) { + el_item = createItemElement(glist[i][0], glist[i][1]); + glist[i][2] = el_item; + el_list.appendChild(el_item); + } } function submitNewItem(string) { @@ -190,7 +190,7 @@ function insertItem(votes, string) { var el = createItemElement(votes, string); if (i == glist.length) { glist.push([votes, string, el]); - el_list.insertBefore(el, document.querySelector(".item.make-new")); + el_list.appendChild(el); } else { var refel = glist[i][2]; glist.splice(i, 0, [votes, string, el]); |