var geos =[
{
"name": "United States of America",
"states": [
{
"name": "California",
"cities": [
{
"name": "San Francisco"
},
{
"name": "San Jose"
}
]
},
{
"name": "New York",
"cities": [
{
"name": "New York City"
},
{
"name": "Broklyn"
}
]
}
]
},
{
"name": "India",
"states": [
{
"name": "Maharastra",
"cities": [
{
"name": "Mumbai"
},
{
"name": "Pune"
}
]
},
{
"name": "New Delhi"
}
]
}
];
/* use thi data to create a part of the form where user can select and drill down to countries, states or available cities. When a country is selected, all underlying states and cities should be selected and vice versa, When all cities under a state are selected, the state should be selectd automatically and when all states are selected the country should be selected automatically */
/*
The selection can be made as smiple as using a checkbox. You can use any library like jqurey or angular for your convenience
*/
/*
Extra: provide a button that will return minimal value, example if new york and california is selected then it should return only 'United States of America' but if Everything is selected except Broklyn, it should return 'California, New York City, India'
*/
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.