Last active
November 8, 2024 05:32
-
-
Save Trshant/180328441d285549144f to your computer and use it in GitHub Desktop.
http://en.wikipedia.org/wiki/List_of_contemporary_ethnic_groups <- List for ethnicity groups. Code to extract data is below the resulting HTML.
This file contains hidden or 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
var rows = $('table.wikitable tr') ; | |
rowlen = rows.length ; | |
rrr = [] ; | |
for( i=1 ; i<rowlen ; i++ ){ | |
row = rows[i]; | |
var v = $(row).find('td a')[0].innerHTML ; | |
//alert( v ); | |
rrr.push( v ); | |
} | |
select_string = '<select name="">\n'; | |
for( i = 0 ; i < rrr.length ; i++ ){ | |
select_string += '<option value="'+ rrr[i] +'">'+ rrr[i] +'</option>\n' | |
} | |
select_string += '</select>\n'; | |
console.log(select_string); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment