diff --git a/bookwyrm/static/js/bookwyrm.js b/bookwyrm/static/js/bookwyrm.js index 0ba4b7c2..6be1d4fb 100644 --- a/bookwyrm/static/js/bookwyrm.js +++ b/bookwyrm/static/js/bookwyrm.js @@ -11,23 +11,23 @@ let BookWyrm = new class { initEventListeners() { // buttons that display or hide content document.querySelectorAll('[data-controls]') - .forEach(button => button.onclick = this.toggleAction.bind(this)); + .forEach(button => button.addEventListener('click', this.toggleAction.bind(this))); // javascript interactions (boost/fav) document.querySelectorAll('.interaction') - .forEach(button => button.onsubmit = this.interact.bind(this)); + .forEach(button => button.addEventListener('submit', this.interact.bind(this))); // handle aria settings on menus document.querySelectorAll('.pulldown-menu') - .forEach(button => button.onclick = this.toggleMenu.bind(this)); + .forEach(button => button.addEventListener('click', this.toggleMenu.bind(this))); // hidden submit button in a form document.querySelectorAll('.hidden-form input') - .forEach(button => button.onchange = this.revealForm.bind(this)); + .forEach(button => button.addEventListener('change', this.revealForm.bind(this))); // browser back behavior document.querySelectorAll('[data-back]') - .forEach(button => button.onclick = this.back); + .forEach(button => button.addEventListener('click', this.back)); } /** diff --git a/bookwyrm/static/js/localstorage.js b/bookwyrm/static/js/localstorage.js index 08b83162..17adf2bf 100644 --- a/bookwyrm/static/js/localstorage.js +++ b/bookwyrm/static/js/localstorage.js @@ -9,7 +9,7 @@ let LocalStorageTools = new class { // update localstorage document.querySelectorAll('.set-display') - .forEach(t => t.onclick = this.updateDisplay.bind(this)); + .forEach(t => t.addEventListener('click', this.updateDisplay.bind(this))); } // set javascript listeners