mirror of
https://github.com/wahyd4/jQuery-Tags-Input.git
synced 2026-08-10 05:18:25 +10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f40465718b | ||
|
|
24832798ae | ||
|
|
af2d7d2e84 | ||
|
|
683637913c |
@@ -1,4 +1,4 @@
|
||||
jQuery Tags Input Plugin 1.3
|
||||
jQuery Tags Input Plugin 1.3.1
|
||||
|
||||
Copyright (c) 2011 XOXCO, Inc
|
||||
|
||||
@@ -47,7 +47,9 @@ $('#tags').tagsInput({
|
||||
autocomplete_url:'http://myserver.com/api/autocomplete'
|
||||
});
|
||||
|
||||
You can also send in options to the autocomplete plugin, as described here.
|
||||
If you're using the bassistance jQuery.autocomplete, which takes extra
|
||||
parameters, you can also send in options to the autocomplete plugin, as
|
||||
described here.
|
||||
|
||||
$('#tags').tagsInput({
|
||||
autocomplete_url:'http://myserver.com/api/autocomplete',
|
||||
|
||||
+18
-27
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
|
||||
jQuery Tags Input Plugin 1.3
|
||||
jQuery Tags Input Plugin 1.3.1
|
||||
|
||||
Copyright (c) 2011 XOXCO, Inc
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
var delimiter = new Array();
|
||||
var tags_callbacks = new Array();
|
||||
var gotAutoComplete = false;
|
||||
|
||||
$.fn.addTag = function(value,options) {
|
||||
var options = jQuery.extend({focus:false,callback:true},options);
|
||||
@@ -125,9 +124,9 @@
|
||||
minChars:0,
|
||||
width:'300px',
|
||||
height:'100px',
|
||||
autocomplete: {selectFirst: false },
|
||||
'hide':true,
|
||||
'delimiter':',',
|
||||
autocomplete:{},
|
||||
'unique':true,
|
||||
removeWithBackspace:true,
|
||||
placeholderColor:'#666666'
|
||||
@@ -194,32 +193,24 @@
|
||||
for (attrname in settings.autocomplete) {
|
||||
autocomplete_options[attrname] = settings.autocomplete[attrname];
|
||||
}
|
||||
|
||||
$(data.fake_input).autocomplete(autocomplete_options).bind('autocompleteselect',data,function(event,ui) {
|
||||
gotAutoComplete = true;
|
||||
$(event.data.real_input).addTag(ui.item.value,{focus:true,unique:(settings.unique)});
|
||||
return false;
|
||||
});
|
||||
|
||||
if (jQuery.Autocompleter !== undefined) {
|
||||
$(data.fake_input).autocomplete(settings.autocomplete_url, settings.autocomplete);
|
||||
$(data.fake_input).bind('result',data,function(event,data,formatted) {
|
||||
if (data) {
|
||||
d = data + "";
|
||||
$(event.data.real_input).addTag(d,{focus:true,unique:(settings.unique)});
|
||||
}
|
||||
});
|
||||
} else if (jQuery.ui.autocomplete !== undefined) {
|
||||
$(data.fake_input).autocomplete(autocomplete_options);
|
||||
$(data.fake_input).bind('autocompleteselect',data,function(event,ui) {
|
||||
$(event.data.real_input).addTag(ui.item.value,{focus:true,unique:(settings.unique)});
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$(data.fake_input).bind('blur',data,function(event) {
|
||||
setTimeout(function() {
|
||||
if(gotAutoComplete == true) {
|
||||
gotAutoComplete = false;
|
||||
return false;
|
||||
}
|
||||
if ( $(event.data.fake_input).val() != $(event.data.fake_input).attr('data-default')) {
|
||||
if((event.data.minChars <= $(event.data.fake_input).val().length) && (!event.data.maxChars || (event.data.maxChars >= $(event.data.fake_input).val().length))) {
|
||||
$(event.data.real_input).addTag($(event.data.fake_input).val(),{focus:false,unique:(settings.unique)});
|
||||
}
|
||||
}
|
||||
|
||||
$(event.data.fake_input).val($(event.data.fake_input).attr('data-default'));
|
||||
$(event.data.fake_input).css('color',settings.placeholderColor);
|
||||
}, 100);
|
||||
return false;
|
||||
});
|
||||
|
||||
} else {
|
||||
// if a user tabs out of the field, create a new tag
|
||||
// this is only available if autocomplete is not used.
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user