From 66c79f7d55f9aa7baf6491aa76f61f7d09f1b7e1 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 15 Jun 2019 13:49:33 -0700 Subject: [PATCH] Use separate array of buttons to prevent index skipping. I didn't know that the HTMLCollection would dynamically update, and removing the class from the button would take them out of the collection. --- frontends/etiquette_flask/static/js/common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontends/etiquette_flask/static/js/common.js b/frontends/etiquette_flask/static/js/common.js index 6e7c7ce..5992d58 100644 --- a/frontends/etiquette_flask/static/js/common.js +++ b/frontends/etiquette_flask/static/js/common.js @@ -155,7 +155,7 @@ function init_button_with_confirm() data-cancel: Text inside the cancel button. Default is "Cancel". data-cancel-class */ - var buttons = document.getElementsByClassName("button_with_confirm"); + var buttons = Array.from(document.getElementsByClassName("button_with_confirm")); for (var index = 0; index < buttons.length; index += 1) { var button = buttons[index];