Created
January 11, 2013 07:17
-
-
Save ankitnetwork18/4508659 to your computer and use it in GitHub Desktop.
cookies: showing something based on javascript cookie
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
//check for cookie and show default city | |
if( typeof getCookie('city_name') == 'undefined') { | |
$('div#delhi').show(); | |
} else { | |
var cookie_city = getCookie('city_name'); | |
$('div#'+cookie_city).show(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment