Skip to content
Advertisement

Retain Values in two related Dropdown List after Page refresh

I have two dropdown lists where on changing the value in the first dropdown, the second dropdown is appended with the values based on the value selected in the first dropdown.

My code is:

JavaScript
JavaScript

Could anyone please suggest me how to retain the selected values in both dropdowns after page refresh?

Advertisement

Answer

Use localStorage.

SO Stacksnippets do not allow them, but try this on your server

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement