How I can use that code with two dropdown menus? Actually when I reload the page the first dropdown menu stays like I want but the second one no. Thanks. Sorry to ask, Im new in all this incredible world!
var init = function () { strong text var sel = $("select"), but = $("button");
    var clearSelected = function () {
      sel.find(":selected").prop("selected", false);
    };
  
    if (localStorage.getItem("pref")) {
      var pref = localStorage.getItem("pref");
      clearSelected();
      //set the selected state to true on the option localStorage remembers
      sel.find("#" + pref).prop("selected", true);
    }
  
    var setPreference = function () {
      //remember the ID of the option the user selected
      localStorage.setItem("pref", sel.find(":selected").attr("id"));
    };
  
    var reset = function () {
      clearSelected();
      localStorage.setItem("pref", undefined);
    };
  
    sel.on("change", setPreference);
    but.on("click", reset);
  };
  $(init);
  **strong text**
 
    