We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It would be really nice to have a feature to make dependent dropdowns. For example, let's imagine we have 2 dropdowns:
Just an idea, but I would really love a functionality like this since mostly all of the existing solutions require jQuery.
The text was updated successfully, but these errors were encountered:
This is technically already possible. I've made an example below for you:
<label for="cities">States</label> <select name="cities" id="cities" placeholder="Choose a state"> <option value="Texas">Texas</option> <option value="Chicago">Chicago</option> <option value="New York">New York</option> <option value="Washington">Washington</option> <option value="Michigan">Michigan</option> </select> <label for="boroughs">Boroughs</label> <select name="boroughs" id="boroughs" placeholder="Choose a borough"> <option value="The Bronx">The Bronx</option> <option value="Brooklyn">Brooklyn</option> <option value="Manhatten">Manhatten</option> <option value="Queens">Queens</option> <option value="Staten Island">Staten Island</option> </select>
document.addEventListener('DOMContentLoaded', function() { var cities = new Choices(document.getElementById('cities'), { callbackOnChange: function(value) { if(value === 'New York') { boroughs.enable(); } else { boroughs.disable(); } } }); var boroughs = new Choices(document.getElementById('boroughs')).disable(); });
You could of course do some fancier validation on the value but you get the idea!
Thanks
Sorry, something went wrong.
No branches or pull requests
It would be really nice to have a feature to make dependent dropdowns. For example, let's imagine we have 2 dropdowns:
Just an idea, but I would really love a functionality like this since mostly all of the existing solutions require jQuery.
The text was updated successfully, but these errors were encountered: