From c6ef14290ac4d96d25843ce2edf61d13e5d9863b Mon Sep 17 00:00:00 2001 From: Zanz2 Date: Tue, 17 Jul 2018 11:41:42 +0200 Subject: [PATCH] Fixes too many events getting bound to a onclick event, by removing them before attaching the event listener again --- app/assets/javascripts/protocols/steps.js.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/protocols/steps.js.erb b/app/assets/javascripts/protocols/steps.js.erb index c41de1592..1bfc3caf3 100644 --- a/app/assets/javascripts/protocols/steps.js.erb +++ b/app/assets/javascripts/protocols/steps.js.erb @@ -9,7 +9,7 @@ // Sets callbacks for toggling checkboxes function applyCheckboxCallBack() { - $("[data-action='check-item']").on('click', function(e){ + $("[data-action='check-item']").off().on('click', function(e){ var checkboxitem = $(this).find("input"); var checked = checkboxitem.is(":checked"); $.ajax({