Permalink
Browse files

fix(toggler): add check if target element is not undefined

  • Loading branch information...
lara-aigmueller committed Apr 24, 2017
1 parent 615cf54 commit 2350cee0085c3d000d2e2866d60d68b3bbb7bdc0
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/js-common-components/toggler.js
@@ -4,8 +4,10 @@ const toggleClass = 'is-active';
$('[data-target]').forEach(el => {
el.addEventListener('click', (ev) => {
ev.preventDefault();
ev.stopPropagation();
$(el.dataset.target)[0].classList.toggle(toggleClass);
if ($(el.dataset.target)[0]) {
ev.preventDefault();
ev.stopPropagation();
$(el.dataset.target)[0].classList.toggle(toggleClass);
}
});
});

0 comments on commit 2350cee

Please sign in to comment.