mirror of
https://github.com/wahyd4/jQuery-Tags-Input.git
synced 2026-08-09 04:46:44 +10:00
changed tab style, and added default value to new unique flag
This commit is contained in:
+16
-15
@@ -30,11 +30,12 @@
|
||||
}
|
||||
|
||||
value = jQuery.trim(value);
|
||||
if (options.unique) {
|
||||
skipTag = $(tagslist).tagExist(value);
|
||||
} else {
|
||||
skipTag = false;
|
||||
}
|
||||
|
||||
if (options.unique) {
|
||||
skipTag = $(tagslist).tagExist(value);
|
||||
} else {
|
||||
skipTag = false;
|
||||
}
|
||||
|
||||
if (value !='' && skipTag != true) {
|
||||
|
||||
@@ -78,15 +79,15 @@
|
||||
|
||||
};
|
||||
|
||||
jQuery.fn.tagExist = function(val) {
|
||||
|
||||
if (jQuery.inArray(val, $(this)) == -1) {
|
||||
return false; /* Cannot find value in array */
|
||||
} else {
|
||||
return true; /* Value found */
|
||||
}
|
||||
};
|
||||
|
||||
jQuery.fn.tagExist = function(val) {
|
||||
|
||||
if (jQuery.inArray(val, $(this)) == -1) {
|
||||
return false; /* Cannot find value in array */
|
||||
} else {
|
||||
return true; /* Value found */
|
||||
}
|
||||
};
|
||||
|
||||
// clear all existing tags and import new ones from a string
|
||||
jQuery.fn.importTags = function(str) {
|
||||
$('#'+id+'_tagsinput .tag').remove();
|
||||
@@ -95,7 +96,7 @@
|
||||
|
||||
jQuery.fn.tagsInput = function(options) {
|
||||
|
||||
var settings = jQuery.extend({defaultText:'add a tag',width:'300px',height:'100px','hide':true,'delimiter':',',autocomplete:{selectFirst:false}},options);
|
||||
var settings = jQuery.extend({defaultText:'add a tag',width:'300px',height:'100px','hide':true,'delimiter':',',autocomplete:{selectFirst:false},'unique':true},options);
|
||||
|
||||
this.each(function() {
|
||||
if (settings.hide) {
|
||||
|
||||
Reference in New Issue
Block a user