Because in multiple.remove, index = $li.index() counts the disabled <li> elements, which are not represented in the _this.value array. We need to look up the value to remove in _this.value or find the correct index with something like $multiple.find('li:not(.input-container):not(.disabled)').index($li).
Because in
multiple.remove
,index = $li.index()
counts the disabled<li>
elements, which are not represented in the_this.value
array. We need to look up the value to remove in_this.value
or find the correct index with something like$multiple.find('li:not(.input-container):not(.disabled)').index($li)
.