It’s very simple to add the pre-defined class name and attribute into the dropdown select input box field to make it work.
When a user selects a country, The state dropdown will automatically populate according to the selection of the country name.
It’s dead simple to add it on your website. You can add it on any kind of website. Whether you have a CMS based site or a static website.
The plugin comes with a single
head or before closing
body tag at end of the page.
Next, Create the list of for country and state. For this, Simply define the select element (without adding option) and add a unique ID for both country & state.
You can add a label if you want. We did add it for demo purpose.
<label>Select Country (with states):</label> <select id="country" name ="country"></select> <label>Select State:</label> <select name ="state" id ="state"></select>
By using this plugin, You have a few advantages:
- No need to save values in the database.
- No need to use Jquery to avoid conflict.
- You can manually add/delete and update countries and states.