odyniec/selectlist — Issue #5: Issue after removing item from list
Author: jschell12
Created: 2011-11-13 16:10:41+00:00
State: open

Just wanted to let you know that there is (or may be) a bug that prevents a user from re-selecting an option in the
"selectlist-select". When I selected an option it went into the ul list. Then I removed it but could not reselect that option unless i selected something else first. therefore I did the following to prevent this:

var sl = jQuery("#ContentType_Edit").selectList({
onRemove: function(select, value, text){
if(jQuery(".selectlist-select").children().first().val() == ""){
jQuery(".selectlist-select")[0].selectedIndex = 0;
}
},
instance: true,
});
jQuery(".selectlist-list").html("");

Also, I set a default selected item called "Please select" which will always show when the page loads. If you notice the
"jQuery(".select-list").html("");" this causes the default option to not get shown as a selected item in the ul list.