Skip to content
Snippets Groups Projects
Commit 56548c5d authored by Chris Lawton's avatar Chris Lawton
Browse files

adding method to clear all filters

parent cf43c044
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
<div class="wrapper wrapper--filters js-filter-wrapper"> <div class="wrapper wrapper--filters js-filter-wrapper">
<div class="wrapper wrapper--filters-header"> <div class="wrapper wrapper--filters-header">
<div class="js-clear-filters">Clear</div>
</div> </div>
<form action="" method="get" class="form form--filters"> <form action="" method="get" class="form form--filters">
......
...@@ -56,6 +56,15 @@ $(function () { ...@@ -56,6 +56,15 @@ $(function () {
e.target.nextElementSibling.classList.add('is-open'); e.target.nextElementSibling.classList.add('is-open');
$('.js-filter-list').addClass('form__filters--mobile'); $('.js-filter-list').addClass('form__filters--mobile');
}); });
// clear all filters
$('.js-clear-filters').on('click', () =>{
const dropdowns = document.querySelectorAll('.form__filters--mobile select');
dropdowns.forEach(dropdown => {
$(dropdown).val(null).trigger('change');
$('.select2-selection.is-active').removeClass('is-active');
});
});
}); });
// wait for DOM content to load before checking for select2 // wait for DOM content to load before checking for select2
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment