Chrome Extension Simple Popup Won't Remain In Last State
The page is reloaded every time the pop-up opens, meaning that state won't persist automatically. You can use sessionStorage to remember the setting for the current session (or even localStorage
if you want it to survive a browser restart). Something like this:
$(document).ready(function() { ... $('button#cus').click(function() { $('div#alaskamap, div#hawaiimap, div#samap, div#japanmap, div#europemap').slideUp(400); $('div#cusmap').delay(400).slideDown(400); sessionStorage.selectedMap = "cus"; }); ... // "Click" the button corresponding to the map previously selected var selectedMap = sessionStorage.selectedMap || "cus"; $('button#' + selectedMap).click();});