Last active
December 22, 2015 19:43
-
-
Save mcavaliere/be9cb91f61e114de8c7c 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
// Heavily Coupled | |
$(function() { | |
$(document.body).append( $('<select id="countries"></select>') ); | |
var countriesIveBeenTo = { | |
'BE': 'Belgium', | |
'CR': 'Costa Rica', | |
'IT': 'Italy', | |
'US': 'United States of America', | |
'UK': 'United Kingdom' | |
}; | |
$.each(countriesIveBeenTo, function(val, text) { | |
$('select#countries').append( | |
$('<option value="' + val + '">' + text + '</option>') | |
); | |
}); | |
$('select#countries').change(function() { | |
console.log('Selected country: ' + $('select#countries :selected').text()); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment