emposha / FCBKcomplete

Jquery facebook like(fancy) multi-select
http://www.emposha.com
383 stars 116 forks source link

Remove items #41

Closed btr closed 13 years ago

btr commented 13 years ago

there is a problem if you have for exemple 2 equals items and remove one. ex "toto" and "toto", you remove only one item "toto". On hidden selectbox the item "toto" isn't selected.

Replace function removeItem(item) { .. }

By :

function removeItem(item) { var sTag = item.attr("rel"); if (!item.hasClass('locked')) {
item.fadeOut("fast"); if (options.onremove) { var _item = element.children("option[value=" + sTag + "]"); funCall(options.onremove, _item) } item.remove();

    // FIXE
    if( ! holder.children("li[rel='" + sTag  + "']").size()) {
        element.children('option[value="' + sTag + '"]').removeAttr("selected").removeClass("selected");
    }

    element.change();
    deleting = 0;
}

}