-
-
Save zlojkashtan/0f8fe90e137a4a360f2c089c2aaebd77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
var $citySelect = $('#city-select'), | |
STORAGE_ITEM_NAME = 'saveCity'; | |
$citySelect.on('change', function () { | |
var url = $citySelect.val(); | |
if (url !== '') { | |
localStorage.setItem(STORAGE_ITEM_NAME, url); | |
window.location = url; | |
} | |
return false; | |
}); | |
if(localStorage.getItem(STORAGE_ITEM_NAME)){ | |
$citySelect.val(localStorage.getItem(STORAGE_ITEM_NAME)); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment