mardi 21 juillet 2020

Checkboxes displayed as checked after using back button even though they are not

Filters on my shop page

enter image description here

They are set to unchecked by default, when i go to shop page using navbar everything works well. However when i check some, go into single product page and press back there, view does not get updated even though checkboxes state is unchecked and all my products are displayed

for(let i=0; i<brandFilters.length; i++)
   console.log(brandFilters[i].checked) // logs 4x false

I tried forcing rerender by doing this, but it doesn't work.

for(let i=0; i<brandFilters.length; i++){
   brandFilters[i].style.display = 'none';
   brandFilters[i].style.display = 'block';
}

Any ideas how to solve this issue?




Aucun commentaire:

Enregistrer un commentaire