Skip to content

Instantly share code, notes, and snippets.

@fermion
Created May 26, 2010 19:45
Show Gist options
  • Save fermion/414955 to your computer and use it in GitHub Desktop.
Save fermion/414955 to your computer and use it in GitHub Desktop.
function select_towns(towns_string) {
var towns_arr = towns_string.split(','),
options = $$('#search_town_data option');
towns_arr.each(function(town_id_string) {
options.select(function(opt) {
return opt.value.match(town_id_string);
}).invoke('writeAttribute','selected',true);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment