changed tab style, and added default value to new unique flag

This commit is contained in:
Ben Brown
2011-04-14 10:53:23 -05:00
parent 3bf0e47ea5
commit 9fd4b31b05
+16 -15
View File
@@ -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) {