Skip to content
Advertisement

How to validate length of query chosen multi-select dropdown

I’m working on the validation part of the jQuery Chosen multi-select. Validation is working fine and I want to allow only one option in the multi-select dropdown. I am trying to get the length of the multi-select but it’s not working. Can anyone tell me how to do this?

Note, when I click on the ‘save’ button I want show an alert like ‘please select only one option’.

Also, multi-select has lot of options but my scenario here is if the drop-down is holding more than one option it should throw the ‘select one option only’ error, as above.

JavaScript
JavaScript

Advertisement

Answer

Updated code.

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement