Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// 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) {
$('<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
You can’t perform that action at this time.