AutoSuggest Multiple Tags - First Element Not Clear When Using Mouse Click

by Naveenkumar 2012-10-24 19:17:51

Hi,

For selecting multiple tags we are using jquery.autoSuggest.js plugin.

In this plugin having one issue like,

The first element we entered in that multiple tags input cannot cleared when we using the mouseclick to delete.

for fixing that issue edit the jquery.autoSuggest.js file code below,



.......
function add_selected_item(data, num)
{

values_input.val(values_input.val()+data[opts.selectedValuesProp]+",");
var item = $('<li class="as-selection-item" id="as-selection-'+num+'">').click(function(){
opts.selectionClick.call(this, $(this));
selections_holder.children().removeClass("selected");
$(this).addClass("selected");
}).mousedown(function(){ input_focus = false; });
var close = $('<a class="as-close">x').click(function(){

//values_input.val(values_input.val().replace(","+data[opts.selectedValuesProp]+",",","));

values_input.val(values_input.val().replace(""+data[opts.selectedValuesProp]+",","")); //ADDED BY ADMIN*** PREV LINE COMMENTED

opts.selectionRemoved.call(this, item);
input_focus = true;
input.focus();
return false;
});
org_li.before(item.html(data[opts.selectedItemProp]).prepend(close));
opts.selectionAdded.call(this, org_li.prev());
}
.......


Comment the red line and uncomment the green line in code..

Hope this helps....

Tagged in:

844
like
1
dislike
0
mail
flag

You must LOGIN to add comments