Question: how to keep the selected value of dropdown in javascript?
Answer: const mySel = document. getElementById("theIDofYourSelect");
mySel. ... 
localStorage. ... 
});
let val = localStorage. ... 
if (val) mySel. ... 
// trigger the change in case there are other events on the select.
mySel.