add javascript so newly added terms can be removed

This commit is contained in:
Frédéric Péters 2013-04-14 17:22:39 +02:00
parent 20670b9910
commit b695a187cf
1 changed files with 8 additions and 0 deletions

View File

@ -58,6 +58,14 @@ function prep_thesaurus_overlay() {
$(field).find('.selected-options').append('<span class="selected-option" data-term-id="' + id + '">' +
'<span>' + title + '</span>' +
'<span class="remove">×</span></span>\n');
$('span.remove').unbind('click').click(function() {
var field = $(this).parents('.field');
var term_id = $(this).parent().attr('data-term-id');
$(field).find('select option[id=' + term_id + ']').remove();
$(this).parent().remove();
});
$(this).parents('.overlay-ajax').find('.close').click();
return false;
});