Forums › Forums › Search & Filter Pro › Enable filters with javascript
Tagged: javascript, trigger
- This topic has 4 replies, 2 voices, and was last updated 4 years, 8 months ago by Trevor.
Viewing 5 posts - 1 through 5 (of 5 total)
-
Anonymous(Private) April 2, 2020 at 10:08 pm #238846
Hello,
I’m trying to check radio buttons with a SVG map like this :
const depts = document.querySelectorAll('#departements path'); const form = document.querySelector('.searchandfilter'); function handleDeptClick(e) { const departementNum = e.target.className.baseVal.split('-').pop(); const inputRadioSelector = <code>input.sf-input-radio[value="${departementNum}"]</code>; const inputRadio = document.querySelector(inputRadioSelector); if ( inputRadio.checked === false ) { inputRadio.checked = true; } } depts.forEach(dept => { dept.addEventListener('click', handleDeptClick); });
this is working great,
but I don’t know how to enable the filtering like this.
If I try to submit the form, it reloads the page entirely.Thanks for any help on this,
David
-
AuthorPosts
Viewing 5 posts - 1 through 5 (of 5 total)