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