how to read/modify tags from a select2 box -
i facing simple problem. have select2 box , want read/change tags. how can this? there seems no way select current tags jquery.
my select2 box looks this:
$('#element').select2({ tags: taglist, showsearchbox: false, minimumresultsforsearch: -1, width: "336px", maximumselectionsize: 10 });
thanks
you have update original list of select
:
1) have list:
<select class='mylist'> <option value='a'>a</option> <option value='b'>b</option> <option value='c'>c</option> </select>
2) init select2 lists:
$('.mylist').select2();
3) user selects option of b
, remove other lists:
// take 'select' elements not current one. //'this' shows <select> tag. try looking values select2, better access real element. $('.mylist').not(this).find('option[value="' + $('option:selected', this).val() + '"]').remove();
4) , update select2 lists:
$('.mylist').select2();
Comments
Post a Comment