Closed arvindvyas closed 10 years ago
$( document ).ready(function() { arrayCountry = ["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia, Plurinational State of", "Bonaire, Sint Eustatius and Saba", "Bosnia and Herzegovina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "Ecuador", "Egypt","El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (Malvinas)", "Faroe Islands", "Fiji", "Finland", "France", "French Guiana", "French Polynesia", "French Southern Territories", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guernsey", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Heard Island and McDonald Islands", "Holy See (Vatican City State)", "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran, Islamic Republic of", "Iraq", "Ireland", "Isle of Man", "Israel", "Italy", "Jamaica", "Japan", "Jersey", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, Democratic People's Republic of", "Korea, Republic of", "Kuwait", "Kyrgyzstan", "Lao People's Democratic Republic", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg", "Macao", "Macedonia, The Former Yugoslav Republic Of", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia, Federated States of", "Moldova, Republic of", "Monaco", "Mongolia", "Montenegro", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepal", "Netherlands", "New Caledonia", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau", "Palestinian Territory, Occupied", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russian Federation", "Rwanda", "Saint Barthelemy", "Saint Helena, Ascension and Tristan da Cunha", "Saint Kitts and Nevis", "Saint Lucia", "Saint Martin (French Part)", "Saint Pierre and Miquelon", "Saint Vincent and the Grenadines", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore", "Sint Maarten (Dutch Part)", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "South Georgia and the South Sandwich Islands", "South Sudan", "Spain", "Sri Lanka", "Sudan", "Suriname", "Svalbard and Jan Mayen", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic", "Taiwan, Province of China", "Tajikistan", "Tanzania, United Republic of", "Thailand", "Timor-Leste", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Turks and Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela, Bolivarian Republic of", "Viet Nam", "Virgin Islands, British", "Virgin Islands, U.S.", "Wallis and Futuna", "Western Sahara", "Yemen", "Zambia", "Zimbabwe"]
$( "#country_id").change(function() { var state = $('#country_id option:selected').text() var indian_state = { 'AP' : 'Andhra Pradesh', 'AR' : 'Arunachal Pradesh', 'AS' : 'Assam', 'BR' : 'Bihar', 'CT' : 'Chhattisgarh', 'GA' : 'Goa', 'GJ' : 'Gujarat', 'HR' : 'Haryana', 'HP' : 'Himachal Pradesh', 'JK' : 'Jammu & Kashmir', 'JH' : 'Jharkhand', 'KA' : 'Karnataka', 'KL' : 'Kerala', 'MP' : 'Madhya Pradesh', 'MH' : 'Maharashtra', 'MN' : 'Manipur', 'ML' : 'Meghalaya', 'MZ' : 'Mizoram', 'NL' : 'Nagaland', 'OR' : 'Odisha', 'PB' : 'Punjab', 'RJ' : 'Rajasthan', 'SK' : 'Sikkim', 'TN' : 'Tamil Nadu', 'TR' : 'Tripura', 'UK' : 'Uttarakhand', 'UP' : 'Uttar Pradesh', 'WB' : 'West Bengal', 'AN' : 'Andaman & Nicobar', 'CH' : 'Chandigarh', 'DN' : 'Dadra and Nagar Haveli', 'DD' : 'Daman & Diu', 'DL' : 'Delhi', 'LD' : 'Lakshadweep', 'PY' : 'Puducherry', }
var usa_state = { 'AL' :"Alabama", 'AK' :"Alaska", 'AZ' :"Arizona", 'AR' :"Arkansas", 'CA' :"California", 'CO' :"Colorado", 'CT' :"Connecticut", 'DE' :"Delaware", 'DC' :"District Of Columbia", 'FL' :"Florida", 'GA' :"Georgia", 'HI' :"Hawaii", 'ID' :"Idaho", 'IL' :"Illinois", 'IN' :"Indiana", 'IA' :"Iowa", 'KS' :"Kansas", 'KY' :"Kentucky", 'LA' :"Louisiana", 'ME' :"Maine", 'MD' :"Maryland", 'MA' :"Massachusetts", 'MI' :"Michigan", 'MN' :"Minnesota", 'MS' :"Mississippi", 'MO' :"Missouri", 'MT' :"Montana", 'NE' :"Nebraska", 'NV' :"Nevada", 'NH' :"New Hampshire", 'NJ' :"New Jersey", 'NM' :"New Mexico", 'NY' :"New York", 'NC' :"North Carolina", 'ND' :"North Dakota", 'OH' :"Ohio", 'OK' :"Oklahoma", 'OR' :"Oregon", 'PA' :"Pennsylvania", 'RI' :"Rhode Island", 'SC' :"South Carolina", 'SD' :"South Dakota", 'TN' :"Tennessee", 'TX' :"Texas", 'UT' :"Utah", 'VT' :"Vermont", 'VA' :"Virginia", 'WA' :"Washington", 'WV' :"West Virginia", 'WI' :"Wisconsin", 'WY' :"Wyoming" }
var canadan_state = { "BC" : "British Columbia", "ON" : "Ontario", "NL" : "Newfoundland and Labrador", "NS" : "Nova Scotia", "PE" : "Prince Edward Island", "NB" : "New Brunswick", "QC" : "Quebec", "MB" : "Manitoba", "SK" : "Saskatchewan", "AB" : "Alberta", "NT" : "Northwest Territories", "NU" : "Nunavut", "YT" : "Yukon Territory" }
var uk_state = { 'GSY' : "Guernsey", 'JSY' : "Jersey", 'BDG' : "Barking and Dagenham", 'BNE' : "Barnet", 'BNS' : "Barnsley", 'BAS' : "Bath and North East Somerset", 'BDF' : "Bedfordshire", 'BEX' : "Bexley", 'BIR' : "Birmingham", 'BBD' : "Blackburn with Darwen", 'BPL' : "Blackpool", 'BOL' : "Bolton", 'BMH' : "Bournemouth", 'BRC' : "Bracknell Forest", 'BRD' : "Bradford", 'BEN' : "Brent", 'BNH' : "Brighton and Hove", 'BST' : "Bristol City of", 'BRY' : "Bromley", 'BKM' : "Buckinghamshire", 'BUR' : "Bury", 'CLD' : "Calderdale", 'CAM' : "Cambridgeshire", 'CMD' : "Camden", 'CHS' : "Cheshire", 'CON' : "Cornwall", 'COV' : "Coventry (West Midlands district)", 'CRY' : "Croydon", 'CMA' : "Cumbria", 'DAL' : "Darlington", 'DER' : "Derby", 'DBY' : "Derbyshire", 'DEV' : "Devon", 'DNC' : "Doncaster", 'DOR' : "Dorset", 'DUD' : "Dudley (West Midlands district)", 'DUR' : "Durham", 'EAL' : "Ealing", 'ERY' : "East Riding of Yorkshire", 'ESX' : "East Sussex", 'ENF' : "Enfield", 'ESS' : "Essex", 'GAT' : "Gateshead (Tyne & Wear district)", 'GLS' : "Gloucestershire", 'GRE' : "Greenwich", 'HCK' : "Hackney", 'HAL' : "Halton", 'HMF' : "Hammersmith and Fulham", 'HAM' : "Hampshire", 'HRY' : "Haringey", 'HRW' : "Harrow", 'HPL' : "Hartlepool", 'HAV' : "Havering", 'HEF' : "Herefordshire County of", 'HRT' : "Hertfordshire", 'HIL' : "Hillingdon", 'HNS' : "Hounslow", 'IOW' : "Isle of Wight", 'IOS' : "Isles of Scilly", 'ISL' : "Islington", 'KEC' : "Kensington and Chelsea", 'KEN' : "Kent", 'KHL' : "Kingston upon Hull City of", 'KTT' : "Kingston upon Thames", 'KIR' : "Kirklees", 'KWL' : "Knowsley", 'LBH' : "Lambeth", 'LAN' : "Lancashire", 'LDS' : "Leeds", 'LCE' : "Leicester", 'LEC' : "Leicestershire", 'LEW' : "Lewisham", 'LIN' : "Lincolnshire", 'LIV' : "Liverpool", 'LND' : "London City of", 'LUT' : "Luton", 'MAN' : "Manchester", 'MDW' : "Medway", 'MRT' : "Merton", 'MDB' : "Middlesbrough", 'MIK' : "Milton Keynes", 'NET' : "Newcastle upon Tyne", 'NWM' : "Newham", 'NFK' : "Norfolk", 'NEL' : "North East Lincolnshire", 'NLN' : "North Lincolnshire", 'NSM' : "North Somerset", 'NTY' : "North Tyneside", 'NYK' : "North Yorkshire", 'NTH' : "Northamptonshire", 'NBL' : "Northumberland", 'NGM' : "Nottingham", 'NTT' : "Nottinghamshire", 'OLD' : "Oldham", 'OXF' : "Oxfordshire", 'PTE' : "Peterborough", 'PLY' : "Plymouth", 'POL' : "Poole", 'POR' : "Portsmouth", 'RDG' : "Reading", 'RDB' : "Redbridge", 'RCC' : "Redcar and Cleveland", 'RIC' : "Richmond upon Thames", 'RCH' : "Rochdale", 'ROT' : "Rotherham", 'RUT' : "Rutland", 'SHN' : "St Helens", 'SLF' : "Salford", 'SAW' : "Sandwell", 'SFT' : "Sefton", 'SHF' : "Sheffield", 'SHR' : "Shropshire", 'SLG' : "Slough", 'SOL' : "Solihull", 'SOM' : "Somerset", 'SGC' : "South Gloucestershire", 'STY' : "South Tyneside", 'STH' : "Southampton", 'SOS' : "Southend-on-Sea", 'SWK' : "Southwark", 'STS' : "Staffordshire", 'SKP' : "Stockport", 'STT' : "Stockton-on-Tees", 'STE' : "Stoke-on-Trent", 'SFK' : "Suffolk", 'SND' : "Sunderland", 'SRY' : "Surrey", 'STN' : "Sutton", 'SWD' : "Swindon", 'TAM' : "Tameside", 'TFW' : "Telford and Wrekin", 'THR' : "Thurrock", 'TOB' : "Torbay", 'TWH' : "Tower Hamlets", 'TRF' : "Trafford", 'WKF' : "Wakefield", 'WLL' : "Walsall", 'WFT' : "Waltham Forest", 'WND' : "Wandsworth", 'WRT' : "Warrington", 'WAR' : "Warwickshire", 'WBK' : "West Berkshire", 'WSX' : "West Sussex", 'WSM' : "Westminster", 'WGN' : "Wigan", 'WIL' : "Wiltshire", 'WNM' : "Windsor and Maidenhead", 'WRL' : "Wirral", 'WOK' : "Wokingham", 'WLV' : "Wolverhampton", 'WOR' : "Worcestershire", 'YOR' : "York", 'ANT' : "Antrim", 'ARD' : "Ards", 'ARM' : "Armagh", 'BLA' : "Ballymena", 'BLY' : "Ballymoney", 'BNB' : "Banbridge", 'BFS' : "Belfast", 'CKF' : "Carrickfergus", 'CSR' : "Castlereagh", 'CLR' : "Coleraine", 'CKT' : "Cookstown", 'CGV' : "Craigavon", 'DRY' : "Derry", 'DOW' : "Down", 'DGN' : "Dungannon and South Tyrone", 'FER' : "Fermanagh", 'LRN' : "Larne", 'LMV' : "Limavady", 'LSB' : "Lisburn", 'MFT' : "Magherafelt", 'MYL' : "Moyle", 'NYM' : "Newry and Mourne", 'NTA' : "Newtownabbey", 'NDN' : "North Down", 'OMH' : "Omagh", 'STB' : "Strabane", 'ABE' : "Aberdeen", 'ABD' : "Aberdeenshire", 'ANS' : "Angus", 'AGB' : "Argyll and Bute", 'CLK' : "Clackmannanshire", 'DGY' : "Dumfries and Galloway", 'DND' : "Dundee", 'EAY' : "East Ayrshire", 'EDU' : "East Dunbartonshire", 'ELN' : "East Lothian", 'ERW' : "East Renfrewshire", 'EDH' : "Edinburgh", 'ELS' : "Eilean Siar", 'FAL' : "Falkirk", 'FIF' : "Fife", 'GLG' : "Glasgow", 'HLD' : "Highland", 'IVC' : "Inverclyde", 'NAY' : "North Ayrshire", 'NLK' : "North Lanarkshire", 'ORK' : "Orkney Islands", 'PKN' : "Perth and Kinross", 'MLN' : "Midlothian", 'MRY' : "Moray", 'RFW' : "Renfrewshire", 'SCB' : "Scottish Borders The", 'ZET' : "Shetland Islands", 'SAY' : "South Ayrshire", 'SLK' : "South Lanarkshire", 'STG' : "Stirling", 'WDU' : "West Dunbartonshire", 'WLN' : "West Lothian", 'BGW' : "Blaenau Gwent", 'BGE' : "Bridgend", 'CAY' : "Caerphilly", 'CRF' : "Cardiff", 'CMN' : "Carmarthenshire", 'CGN' : "Ceredigion", 'CWY' : "Conwy", 'DEN' : "Denbighshire", 'FLN' : "Flintshire", 'GWN' : "Gwynedd", 'AGY' : "Isle of Anglesey", 'MTY' : "Merthyr Tydfil", 'MON' : "Monmouthshire", 'NTL' : "Neath Port Talbot", 'NWP' : "Newport", 'PEM' : "Pembrokeshire", 'POW' : "Powys", 'RCT' : "Rhondda Cynon Taf", 'SWA' : "Swansea", 'TOF' : "Torfaen", 'VGL' : "Vale of Glamorgan", 'WRX' : "Wrexham", 'ABD' : 'Aberdeenshire', 'ALD' : 'Alderney', 'AGY' : 'Anglesey (Isle of)', 'ANS' : 'Angus', 'AGB' : 'Argyll and Bute', 'AYR' : 'Ayrshire', 'BAN' : 'Banffshire', 'BDF' : 'Bedfordshire', 'BRK' : 'Berkshire', 'BEW' : 'Berwickshire', 'BGW' : 'Blaenau Gwent', 'BOR' : 'Borders', 'BGE' : 'Bridgend', 'BST' : 'Bristol', 'BKM' : 'Buckinghamshire', 'CAY' : 'Caerphilly', 'CAI' : 'Caithness', 'CAM' : 'Cambridgeshire', 'CRF' : 'Cardiff', 'CMN' : 'Carmarthenshire', 'CEN' : 'Central Scotland', 'CGN' : 'Ceredigion', 'CHI' : 'Channel Islands', 'CHS' : 'Cheshire', 'CLK' : 'Clackmannanshire', 'CWD' : 'Clwyd', 'CWY' : 'Conwy', 'CON' : 'Cornwall', 'ANT' : 'County Antrim', 'ARM' : 'County Armagh', 'DOW' : 'County Down', 'DUR' : 'County Durham', 'TYR' : 'County Tyrone', 'CMA' : 'Cumbria', 'DEN' : 'Denbighshire', 'DER' : 'Derbyshire', 'DEV' : 'Devon', 'DOR' : 'Dorset', 'DGY' : 'Dumfries & Galloway', 'DNB' : 'Dunbartonshire', 'DYD' : 'Dyfed', 'ELN' : 'East Lothian', 'ERY' : 'East Riding of Yorkshire', 'ESX' : 'East Sussex', 'ESS' : 'Essex', 'FER' : 'Fermanagh', 'FIF' : 'Fife', 'FLN' : 'Flintshire', 'GLA' : 'Glamorgan', 'GLS' : 'Gloucestershire', 'GMP' : 'Grampian', 'GSY' : 'Guernsey', 'GNT' : 'Gwent', 'GWN' : 'Gwynedd', 'HAM' : 'Hampshire', 'HEF' : 'Herefordshire', 'HRT' : 'Hertfordshire', 'HLD' : 'Highlands', 'INV' : 'Inverness-shire', 'IOM' : 'Isle of Man', 'IOW' : 'Isle of Wight', 'JSY' : 'Jersey', 'KEN' : 'Kent', 'KCD' : 'Kincardineshire', 'KRS' : 'Kinross-shire', 'KKD' : 'Kirkcudbrightshire', 'LKS' : 'Lanarkshire', 'LAN' : 'Lancashire', 'LEI' : 'Leicestershire', 'LIN' : 'Lincolnshire', 'LND' : 'London', 'LDY' : 'Londonderry', 'GTM' : 'Manchester (Greater)', 'MSY' : 'Merseyside', 'MTY' : 'Merthyr Tydfil', 'MDX' : 'Middlesex', 'MLN' : 'Midlothian', 'MON' : 'Monmouthshire', 'MOR' : 'Moray', 'NAI' : 'Nairnshire', 'NTL' : 'Neath Port Talbot', 'NWP' : 'Newport', 'NFK' : 'Norfolk', 'NYK' : 'North Yorkshire', 'NTH' : 'Northamptonshire', 'NBL' : 'Northumberland', 'NTT' : 'Nottinghamshire', 'OKI' : 'Orkney', 'OXF' : 'Oxfordshire', 'PEE' : 'Peeblesshire', 'PEM' : 'Pembrokeshire', 'PER' : 'Perthshire', 'POW' : 'Powys', 'RFW' : 'Renfrewshire', 'RCT' : 'Rhondda Cynon Taff', 'ROC' : 'Ross and Cromarty', 'ROX' : 'Roxburghshire', 'SEL' : 'Selkirkshire', 'SHI' : 'Shetland', 'SHR' : 'Shropshire', 'SOM' : 'Somerset', 'SYK' : 'South Yorkshire', 'STS' : 'Staffordshire', 'STI' : 'Stirlingshire', 'STD' : 'Strathclyde', 'SFK' : 'Suffolk', 'SRY' : 'Surrey', 'SUT' : 'Sutherland', 'SWA' : 'Swansea', 'TAY' : 'Tayside', 'TOF' : 'Torfaen', 'TWR' : 'Tyne & Wear', 'WAR' : 'Warwickshire', 'WLN' : 'West Lothian', 'WMD' : 'West Midlands', 'SXW' : 'West Sussex', 'WYK' : 'West Yorkshire', 'WIS' : 'Western Isles', 'WIG' : 'Wigtownshire', 'WIL' : 'Wiltshire', 'WOR' : 'Worcestershire', 'WRX' : 'Wrexham' }
switch ( state ) { case "India": default_state = indian_state break case "United Kingdom": default_state = uk_state break; case "Canada": default_state = canadan_state break; case "United States": default_state = usa_state break; default: alert( "here required to add one input box" ); } var s = $('');
for(var val in default_state) { $('', {value: val, text: default_state[val]}).appendTo(s); }
$('#second_select').html(s); // or wherever it should be }); });
I don't want to use the array which I have mention inside the js like this this could be use from the gem it self and if there would be no matching it should create a input box for filing the state name there
$( document ).ready(function() { arrayCountry = ["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia, Plurinational State of", "Bonaire, Sint Eustatius and Saba", "Bosnia and Herzegovina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "Ecuador", "Egypt","El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (Malvinas)", "Faroe Islands", "Fiji", "Finland", "France", "French Guiana", "French Polynesia", "French Southern Territories", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guernsey", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Heard Island and McDonald Islands", "Holy See (Vatican City State)", "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran, Islamic Republic of", "Iraq", "Ireland", "Isle of Man", "Israel", "Italy", "Jamaica", "Japan", "Jersey", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, Democratic People's Republic of", "Korea, Republic of", "Kuwait", "Kyrgyzstan", "Lao People's Democratic Republic", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg", "Macao", "Macedonia, The Former Yugoslav Republic Of", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia, Federated States of", "Moldova, Republic of", "Monaco", "Mongolia", "Montenegro", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepal", "Netherlands", "New Caledonia", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau", "Palestinian Territory, Occupied", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russian Federation", "Rwanda", "Saint Barthelemy", "Saint Helena, Ascension and Tristan da Cunha", "Saint Kitts and Nevis", "Saint Lucia", "Saint Martin (French Part)", "Saint Pierre and Miquelon", "Saint Vincent and the Grenadines", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore", "Sint Maarten (Dutch Part)", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "South Georgia and the South Sandwich Islands", "South Sudan", "Spain", "Sri Lanka", "Sudan", "Suriname", "Svalbard and Jan Mayen", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic", "Taiwan, Province of China", "Tajikistan", "Tanzania, United Republic of", "Thailand", "Timor-Leste", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Turks and Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela, Bolivarian Republic of", "Viet Nam", "Virgin Islands, British", "Virgin Islands, U.S.", "Wallis and Futuna", "Western Sahara", "Yemen", "Zambia", "Zimbabwe"]
$( "#country_id").change(function() { var state = $('#country_id option:selected').text() var indian_state = { 'AP' : 'Andhra Pradesh', 'AR' : 'Arunachal Pradesh', 'AS' : 'Assam', 'BR' : 'Bihar', 'CT' : 'Chhattisgarh', 'GA' : 'Goa', 'GJ' : 'Gujarat', 'HR' : 'Haryana', 'HP' : 'Himachal Pradesh', 'JK' : 'Jammu & Kashmir', 'JH' : 'Jharkhand', 'KA' : 'Karnataka', 'KL' : 'Kerala', 'MP' : 'Madhya Pradesh', 'MH' : 'Maharashtra', 'MN' : 'Manipur', 'ML' : 'Meghalaya', 'MZ' : 'Mizoram', 'NL' : 'Nagaland', 'OR' : 'Odisha', 'PB' : 'Punjab', 'RJ' : 'Rajasthan', 'SK' : 'Sikkim', 'TN' : 'Tamil Nadu', 'TR' : 'Tripura', 'UK' : 'Uttarakhand', 'UP' : 'Uttar Pradesh', 'WB' : 'West Bengal', 'AN' : 'Andaman & Nicobar', 'CH' : 'Chandigarh', 'DN' : 'Dadra and Nagar Haveli', 'DD' : 'Daman & Diu', 'DL' : 'Delhi', 'LD' : 'Lakshadweep', 'PY' : 'Puducherry', }
var usa_state = { 'AL' :"Alabama", 'AK' :"Alaska", 'AZ' :"Arizona", 'AR' :"Arkansas", 'CA' :"California", 'CO' :"Colorado", 'CT' :"Connecticut", 'DE' :"Delaware", 'DC' :"District Of Columbia", 'FL' :"Florida", 'GA' :"Georgia", 'HI' :"Hawaii", 'ID' :"Idaho", 'IL' :"Illinois", 'IN' :"Indiana", 'IA' :"Iowa", 'KS' :"Kansas", 'KY' :"Kentucky", 'LA' :"Louisiana", 'ME' :"Maine", 'MD' :"Maryland", 'MA' :"Massachusetts", 'MI' :"Michigan", 'MN' :"Minnesota", 'MS' :"Mississippi", 'MO' :"Missouri", 'MT' :"Montana", 'NE' :"Nebraska", 'NV' :"Nevada", 'NH' :"New Hampshire", 'NJ' :"New Jersey", 'NM' :"New Mexico", 'NY' :"New York", 'NC' :"North Carolina", 'ND' :"North Dakota", 'OH' :"Ohio", 'OK' :"Oklahoma", 'OR' :"Oregon", 'PA' :"Pennsylvania", 'RI' :"Rhode Island", 'SC' :"South Carolina", 'SD' :"South Dakota", 'TN' :"Tennessee", 'TX' :"Texas", 'UT' :"Utah", 'VT' :"Vermont", 'VA' :"Virginia", 'WA' :"Washington", 'WV' :"West Virginia", 'WI' :"Wisconsin", 'WY' :"Wyoming" }
var canadan_state = { "BC" : "British Columbia", "ON" : "Ontario", "NL" : "Newfoundland and Labrador", "NS" : "Nova Scotia", "PE" : "Prince Edward Island", "NB" : "New Brunswick", "QC" : "Quebec", "MB" : "Manitoba", "SK" : "Saskatchewan", "AB" : "Alberta", "NT" : "Northwest Territories", "NU" : "Nunavut", "YT" : "Yukon Territory" }
var uk_state = { 'GSY' : "Guernsey", 'JSY' : "Jersey", 'BDG' : "Barking and Dagenham", 'BNE' : "Barnet", 'BNS' : "Barnsley", 'BAS' : "Bath and North East Somerset", 'BDF' : "Bedfordshire", 'BEX' : "Bexley", 'BIR' : "Birmingham", 'BBD' : "Blackburn with Darwen", 'BPL' : "Blackpool", 'BOL' : "Bolton", 'BMH' : "Bournemouth", 'BRC' : "Bracknell Forest", 'BRD' : "Bradford", 'BEN' : "Brent", 'BNH' : "Brighton and Hove", 'BST' : "Bristol City of", 'BRY' : "Bromley", 'BKM' : "Buckinghamshire", 'BUR' : "Bury", 'CLD' : "Calderdale", 'CAM' : "Cambridgeshire", 'CMD' : "Camden", 'CHS' : "Cheshire", 'CON' : "Cornwall", 'COV' : "Coventry (West Midlands district)", 'CRY' : "Croydon", 'CMA' : "Cumbria", 'DAL' : "Darlington", 'DER' : "Derby", 'DBY' : "Derbyshire", 'DEV' : "Devon", 'DNC' : "Doncaster", 'DOR' : "Dorset", 'DUD' : "Dudley (West Midlands district)", 'DUR' : "Durham", 'EAL' : "Ealing", 'ERY' : "East Riding of Yorkshire", 'ESX' : "East Sussex", 'ENF' : "Enfield", 'ESS' : "Essex", 'GAT' : "Gateshead (Tyne & Wear district)", 'GLS' : "Gloucestershire", 'GRE' : "Greenwich", 'HCK' : "Hackney", 'HAL' : "Halton", 'HMF' : "Hammersmith and Fulham", 'HAM' : "Hampshire", 'HRY' : "Haringey", 'HRW' : "Harrow", 'HPL' : "Hartlepool", 'HAV' : "Havering", 'HEF' : "Herefordshire County of", 'HRT' : "Hertfordshire", 'HIL' : "Hillingdon", 'HNS' : "Hounslow", 'IOW' : "Isle of Wight", 'IOS' : "Isles of Scilly", 'ISL' : "Islington", 'KEC' : "Kensington and Chelsea", 'KEN' : "Kent", 'KHL' : "Kingston upon Hull City of", 'KTT' : "Kingston upon Thames", 'KIR' : "Kirklees", 'KWL' : "Knowsley", 'LBH' : "Lambeth", 'LAN' : "Lancashire", 'LDS' : "Leeds", 'LCE' : "Leicester", 'LEC' : "Leicestershire", 'LEW' : "Lewisham", 'LIN' : "Lincolnshire", 'LIV' : "Liverpool", 'LND' : "London City of", 'LUT' : "Luton", 'MAN' : "Manchester", 'MDW' : "Medway", 'MRT' : "Merton", 'MDB' : "Middlesbrough", 'MIK' : "Milton Keynes", 'NET' : "Newcastle upon Tyne", 'NWM' : "Newham", 'NFK' : "Norfolk", 'NEL' : "North East Lincolnshire", 'NLN' : "North Lincolnshire", 'NSM' : "North Somerset", 'NTY' : "North Tyneside", 'NYK' : "North Yorkshire", 'NTH' : "Northamptonshire", 'NBL' : "Northumberland", 'NGM' : "Nottingham", 'NTT' : "Nottinghamshire", 'OLD' : "Oldham", 'OXF' : "Oxfordshire", 'PTE' : "Peterborough", 'PLY' : "Plymouth", 'POL' : "Poole", 'POR' : "Portsmouth", 'RDG' : "Reading", 'RDB' : "Redbridge", 'RCC' : "Redcar and Cleveland", 'RIC' : "Richmond upon Thames", 'RCH' : "Rochdale", 'ROT' : "Rotherham", 'RUT' : "Rutland", 'SHN' : "St Helens", 'SLF' : "Salford", 'SAW' : "Sandwell", 'SFT' : "Sefton", 'SHF' : "Sheffield", 'SHR' : "Shropshire", 'SLG' : "Slough", 'SOL' : "Solihull", 'SOM' : "Somerset", 'SGC' : "South Gloucestershire", 'STY' : "South Tyneside", 'STH' : "Southampton", 'SOS' : "Southend-on-Sea", 'SWK' : "Southwark", 'STS' : "Staffordshire", 'SKP' : "Stockport", 'STT' : "Stockton-on-Tees", 'STE' : "Stoke-on-Trent", 'SFK' : "Suffolk", 'SND' : "Sunderland", 'SRY' : "Surrey", 'STN' : "Sutton", 'SWD' : "Swindon", 'TAM' : "Tameside", 'TFW' : "Telford and Wrekin", 'THR' : "Thurrock", 'TOB' : "Torbay", 'TWH' : "Tower Hamlets", 'TRF' : "Trafford", 'WKF' : "Wakefield", 'WLL' : "Walsall", 'WFT' : "Waltham Forest", 'WND' : "Wandsworth", 'WRT' : "Warrington", 'WAR' : "Warwickshire", 'WBK' : "West Berkshire", 'WSX' : "West Sussex", 'WSM' : "Westminster", 'WGN' : "Wigan", 'WIL' : "Wiltshire", 'WNM' : "Windsor and Maidenhead", 'WRL' : "Wirral", 'WOK' : "Wokingham", 'WLV' : "Wolverhampton", 'WOR' : "Worcestershire", 'YOR' : "York", 'ANT' : "Antrim", 'ARD' : "Ards", 'ARM' : "Armagh", 'BLA' : "Ballymena", 'BLY' : "Ballymoney", 'BNB' : "Banbridge", 'BFS' : "Belfast", 'CKF' : "Carrickfergus", 'CSR' : "Castlereagh", 'CLR' : "Coleraine", 'CKT' : "Cookstown", 'CGV' : "Craigavon", 'DRY' : "Derry", 'DOW' : "Down", 'DGN' : "Dungannon and South Tyrone", 'FER' : "Fermanagh", 'LRN' : "Larne", 'LMV' : "Limavady", 'LSB' : "Lisburn", 'MFT' : "Magherafelt", 'MYL' : "Moyle", 'NYM' : "Newry and Mourne", 'NTA' : "Newtownabbey", 'NDN' : "North Down", 'OMH' : "Omagh", 'STB' : "Strabane", 'ABE' : "Aberdeen", 'ABD' : "Aberdeenshire", 'ANS' : "Angus", 'AGB' : "Argyll and Bute", 'CLK' : "Clackmannanshire", 'DGY' : "Dumfries and Galloway", 'DND' : "Dundee", 'EAY' : "East Ayrshire", 'EDU' : "East Dunbartonshire", 'ELN' : "East Lothian", 'ERW' : "East Renfrewshire", 'EDH' : "Edinburgh", 'ELS' : "Eilean Siar", 'FAL' : "Falkirk", 'FIF' : "Fife", 'GLG' : "Glasgow", 'HLD' : "Highland", 'IVC' : "Inverclyde", 'NAY' : "North Ayrshire", 'NLK' : "North Lanarkshire", 'ORK' : "Orkney Islands", 'PKN' : "Perth and Kinross", 'MLN' : "Midlothian", 'MRY' : "Moray", 'RFW' : "Renfrewshire", 'SCB' : "Scottish Borders The", 'ZET' : "Shetland Islands", 'SAY' : "South Ayrshire", 'SLK' : "South Lanarkshire", 'STG' : "Stirling", 'WDU' : "West Dunbartonshire", 'WLN' : "West Lothian", 'BGW' : "Blaenau Gwent", 'BGE' : "Bridgend", 'CAY' : "Caerphilly", 'CRF' : "Cardiff", 'CMN' : "Carmarthenshire", 'CGN' : "Ceredigion", 'CWY' : "Conwy", 'DEN' : "Denbighshire", 'FLN' : "Flintshire", 'GWN' : "Gwynedd", 'AGY' : "Isle of Anglesey", 'MTY' : "Merthyr Tydfil", 'MON' : "Monmouthshire", 'NTL' : "Neath Port Talbot", 'NWP' : "Newport", 'PEM' : "Pembrokeshire", 'POW' : "Powys", 'RCT' : "Rhondda Cynon Taf", 'SWA' : "Swansea", 'TOF' : "Torfaen", 'VGL' : "Vale of Glamorgan", 'WRX' : "Wrexham", 'ABD' : 'Aberdeenshire', 'ALD' : 'Alderney', 'AGY' : 'Anglesey (Isle of)', 'ANS' : 'Angus', 'AGB' : 'Argyll and Bute', 'AYR' : 'Ayrshire', 'BAN' : 'Banffshire', 'BDF' : 'Bedfordshire', 'BRK' : 'Berkshire', 'BEW' : 'Berwickshire', 'BGW' : 'Blaenau Gwent', 'BOR' : 'Borders', 'BGE' : 'Bridgend', 'BST' : 'Bristol', 'BKM' : 'Buckinghamshire', 'CAY' : 'Caerphilly', 'CAI' : 'Caithness', 'CAM' : 'Cambridgeshire', 'CRF' : 'Cardiff', 'CMN' : 'Carmarthenshire', 'CEN' : 'Central Scotland', 'CGN' : 'Ceredigion', 'CHI' : 'Channel Islands', 'CHS' : 'Cheshire', 'CLK' : 'Clackmannanshire', 'CWD' : 'Clwyd', 'CWY' : 'Conwy', 'CON' : 'Cornwall', 'ANT' : 'County Antrim', 'ARM' : 'County Armagh', 'DOW' : 'County Down', 'DUR' : 'County Durham', 'TYR' : 'County Tyrone', 'CMA' : 'Cumbria', 'DEN' : 'Denbighshire', 'DER' : 'Derbyshire', 'DEV' : 'Devon', 'DOR' : 'Dorset', 'DGY' : 'Dumfries & Galloway', 'DNB' : 'Dunbartonshire', 'DYD' : 'Dyfed', 'ELN' : 'East Lothian', 'ERY' : 'East Riding of Yorkshire', 'ESX' : 'East Sussex', 'ESS' : 'Essex', 'FER' : 'Fermanagh', 'FIF' : 'Fife', 'FLN' : 'Flintshire', 'GLA' : 'Glamorgan', 'GLS' : 'Gloucestershire', 'GMP' : 'Grampian', 'GSY' : 'Guernsey', 'GNT' : 'Gwent', 'GWN' : 'Gwynedd', 'HAM' : 'Hampshire', 'HEF' : 'Herefordshire', 'HRT' : 'Hertfordshire', 'HLD' : 'Highlands', 'INV' : 'Inverness-shire', 'IOM' : 'Isle of Man', 'IOW' : 'Isle of Wight', 'JSY' : 'Jersey', 'KEN' : 'Kent', 'KCD' : 'Kincardineshire', 'KRS' : 'Kinross-shire', 'KKD' : 'Kirkcudbrightshire', 'LKS' : 'Lanarkshire', 'LAN' : 'Lancashire', 'LEI' : 'Leicestershire', 'LIN' : 'Lincolnshire', 'LND' : 'London', 'LDY' : 'Londonderry', 'GTM' : 'Manchester (Greater)', 'MSY' : 'Merseyside', 'MTY' : 'Merthyr Tydfil', 'MDX' : 'Middlesex', 'MLN' : 'Midlothian', 'MON' : 'Monmouthshire', 'MOR' : 'Moray', 'NAI' : 'Nairnshire', 'NTL' : 'Neath Port Talbot', 'NWP' : 'Newport', 'NFK' : 'Norfolk', 'NYK' : 'North Yorkshire', 'NTH' : 'Northamptonshire', 'NBL' : 'Northumberland', 'NTT' : 'Nottinghamshire', 'OKI' : 'Orkney', 'OXF' : 'Oxfordshire', 'PEE' : 'Peeblesshire', 'PEM' : 'Pembrokeshire', 'PER' : 'Perthshire', 'POW' : 'Powys', 'RFW' : 'Renfrewshire', 'RCT' : 'Rhondda Cynon Taff', 'ROC' : 'Ross and Cromarty', 'ROX' : 'Roxburghshire', 'SEL' : 'Selkirkshire', 'SHI' : 'Shetland', 'SHR' : 'Shropshire', 'SOM' : 'Somerset', 'SYK' : 'South Yorkshire', 'STS' : 'Staffordshire', 'STI' : 'Stirlingshire', 'STD' : 'Strathclyde', 'SFK' : 'Suffolk', 'SRY' : 'Surrey', 'SUT' : 'Sutherland', 'SWA' : 'Swansea', 'TAY' : 'Tayside', 'TOF' : 'Torfaen', 'TWR' : 'Tyne & Wear', 'WAR' : 'Warwickshire', 'WLN' : 'West Lothian', 'WMD' : 'West Midlands', 'SXW' : 'West Sussex', 'WYK' : 'West Yorkshire', 'WIS' : 'Western Isles', 'WIG' : 'Wigtownshire', 'WIL' : 'Wiltshire', 'WOR' : 'Worcestershire', 'WRX' : 'Wrexham' }
switch ( state ) { case "India": default_state = indian_state break case "United Kingdom": default_state = uk_state break; case "Canada": default_state = canadan_state break; case "United States": default_state = usa_state break; default: alert( "here required to add one input box" ); } var s = $('');
for(var val in default_state) { $('', {value: val, text: default_state[val]}).appendTo(s); }
$('#second_select').html(s); // or wherever it should be }); });