diff options
-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]); |