Skip to content

Instantly share code, notes, and snippets.

@kalkulus
Created May 14, 2013 11:56
Show Gist options
  • Save kalkulus/5575383 to your computer and use it in GitHub Desktop.
Save kalkulus/5575383 to your computer and use it in GitHub Desktop.
JavaScript - jQuery code to harvest and format country names and country codes from http://countrycode.org/
var list = [];
$('#main_table_blue tbody tr').each(function(){
countryName = $(this).find('td:first-child a').text();
countryCode = $(this).find('td:nth-child(3)').text();
list.push('+'+countryCode+' '+countryName);
});
$('body').append('<div id="countrycodes"></div>"');
$('#countrycodes').append(list.join('<br />'));
console.debug(list);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment