fix to issue #28

https://github.com/xoxco/jQuery-Tags-Input/issues/28
onChange now receives the tag added or removed.
This commit is contained in:
Ben Brown
2011-11-15 11:41:58 -08:00
parent 5437401613
commit 49fc5f3ab1
2 changed files with 8 additions and 2 deletions
+1 -1
View File
@@ -126,7 +126,7 @@
{
var i = tagslist.length;
var f = tags_callbacks[id]['onChange'];
f.call(this, $(this), tagslist[i]);
f.call(this, $(this), tagslist[i-1]);
}
}
+7 -1
View File
@@ -25,7 +25,12 @@
alert("Removed a tag: " + tag);
}
function onChangeTag(input,tag) {
alert("Changed a tag: " + tag);
}
$(function() {
$('#tags_1').tagsInput();
$('#tags_2').tagsInput({
onChange: function(elem, elem_tags)
@@ -43,8 +48,9 @@
autocomplete_url:'test/fake_json_endpoint.html' // jquery ui autocomplete requires a json endpoint
});
// Uncomment this line to see the callback functions in action
// $('input.tags').tagsInput({onAddTag:onAddTag,onRemoveTag:onRemoveTag});
// $('input.tags').tagsInput({onAddTag:onAddTag,onRemoveTag:onRemoveTag,onChange: onChangeTag});
// Uncomment this line to see an input with no interface for adding new tags.
// $('input.tags').tagsInput({interactive:false});