Link to home
Start Free TrialLog in
Avatar of Sergej Akstiukevič
Sergej Akstiukevič

asked on

save checkbox state inside google map infowindow

I have multiple markers which are loaded on window load and I am dynamically creating data for each info window.

All the infowindows of marker contains checkboxes. How can I save the state of checkbox and then display the state when the info window is clicked (also the data in info window should be loaded when the marker is clicked). Now chechbox is unchecked after i close info window. I tried localstorage, but it dont work for checkboxes inside infowindow. https://jsfiddle.net/pg3b62x4/2/
Avatar of Dorababu M
Dorababu M
Flag of India image

How about sessionStorage
Avatar of Sergej Akstiukevič
Sergej Akstiukevič

ASKER

no difference
Your fiddle is not showing any map can you update it and send working fiddle
https://jsfiddle.net/7acz5x4g/6/ I really hope for your help
So you are trying to load the map when the 3 checkboxes were clicked?
Use
 
$(document).ready(function() {
  $('input[type=checkbox]').click(function(){

Open in new window

instead of
 $(document).ready(function() {
  $('input:checkbox').on('change', function(e) {

Open in new window

check this fiddle, does is fit your requirement https://jsfiddle.net/DorababuMeka/7acz5x4g/12/
no :( as you can see when you click on marker there is a checkbox. when i check that checkbox and close the infowindow, then reopen it checkbox is unchecked :(
I suspect you may be being tripped up by the equivalent of a cache.
Reopening the marker simple displays the created state.

You will need to set the checkbox state every time that "infowindow.open" happens.

just a thought.
Roy
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.