Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <html>
<head>
<meta charset="utf-8">
<title>viewtechindia.com</title>
</head>
<body>
<form class="form" name="myform" id="myForm">
  <lable class="label">Select Country:</lable> <select class="select" name="state" id="countySel" size="1">
<option value="" selected="selected">Select Country</option>
</select>
<br>
<br>
<lable class="label">Select State:</lable> <select class="select" name="countrya" id="stateSel" size="1">
<option class="option" value="" selected="selected">Please select Country first</option>
</select>
<br>
<br>
<lable class="label">Select District: </lable><select class="select" name="district" id="districtSel" size="1">
<option value="" selected="selected">Please select State first</option>
</select><br>
<input class="submit-button"  type="submit">
</form>
</body>
</html>
              
            
!

CSS

              
                body {
  font-family: system-ui;
  background: #f06d06;
  color: white;
  text-align: center;
}

.form {
  border:solid 1px #ffffff;
  padding:40px;
  text-align:left;
  display:block;
  margin:65px auto 0px auto;
  max-width:400px;
  border-radius:5px;  background:rbga(256,256,256, 0.5);
}

.select {
  height:35px;
   border-radius:5px;
  min-width:250px;
  padding:7px 7px;
}

.label {
  min-width:130px;
  display:inline-block;
}

.submit-button {
  height:35px;
   border-radius:5px;
  min-width:250px;
  padding:7px 7px;
  border:none;
  background:#f2f2f2;
  margin-left:130px;
    margin-top:25px
}
              
            
!

JS

              
                
var stateObject = {
"India": { "Delhi": ["new Delhi", "North Delhi"],
"Kerala": ["Thiruvananthapuram", "Palakkad"],
"Goa": ["North Goa", "South Goa"],
},
"Australia": {
"South Australia": ["Dunstan", "Mitchell"],
"Victoria": ["Altona", "Euroa"]
}, "Canada": {
"Alberta": ["Acadia", "Bighorn"],
"Columbia": ["Washington", ""]
},
}
window.onload = function () {
var countySel = document.getElementById("countySel"),
stateSel = document.getElementById("stateSel"),
districtSel = document.getElementById("districtSel");
for (var country in stateObject) {
countySel.options[countySel.options.length] = new Option(country, country);
}
countySel.onchange = function () {
stateSel.length = 1; // remove all options bar first
districtSel.length = 1; // remove all options bar first
if (this.selectedIndex < 1) return; // done
for (var state in stateObject[this.value]) {
stateSel.options[stateSel.options.length] = new Option(state, state);
}
}
countySel.onchange(); // reset in case page is reloaded
stateSel.onchange = function () {
districtSel.length = 1; // remove all options bar first
if (this.selectedIndex < 1) return; // done
var district = stateObject[countySel.value][this.value];
for (var i = 0; i < district.length; i++) {
districtSel.options[districtSel.options.length] = new Option(district[i], district[i]);
}
}
}

              
            
!
999px

Console