chosen js dropdown last select issue

Error on last item selection

When I select last item on second time. It is giving an error “Uncaught TypeError: Cannot set property ‘selected’ of undefined” on every chosen.


I had the same problem with this behavior. I used the following as workaround:

    ng-options=" for item in itemList"
    <option value=""></option>

And options from:

$scope.itemList = ['Option1', 'Option2', 'Option3'];        


$scope.itemList = [{name: 'Option1'}, {name: 'Option2'}, {name: 'Option3'}];   


Whilst not ideal, I found the solution to be similar as whats referenced above.

Instead of using hardcoded <option> use ng-options with 1 disabled option like so:

<select chosen ng-model="model" ng-options="o as o for o in array_of_options">
  <option disabled></option>


One thought on “chosen js dropdown last select issue

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s