mirror of
https://github.com/wahyd4/jQuery-Tags-Input.git
synced 2026-08-09 12:56:35 +10:00
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:
+1
-1
@@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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});
|
||||
|
||||
Reference in New Issue
Block a user