Fixed issue #49 - tagExist() now works correctly

This commit is contained in:
Tomasz Tybulewicz
2012-03-13 19:59:46 +01:00
parent 6d2b1d3b72
commit b56a968f97
+4 -2
View File
@@ -86,7 +86,7 @@
value = jQuery.trim(value);
if (options.unique) {
var skipTag = $(tagslist).tagExist(value);
var skipTag = $(this).tagExist(value);
if(skipTag == true) {
//Marks fake input as not_valid to let styling it
$('#'+id+'_tag').addClass('not_valid');
@@ -162,7 +162,9 @@
};
$.fn.tagExist = function(val) {
return (jQuery.inArray(val, $(this)) >= 0); //true when tag exists, false when not
var id = $(this).attr('id');
var tagslist = $(this).val().split(delimiter[id]);
return (jQuery.inArray(val, tagslist) >= 0); //true when tag exists, false when not
};
// clear all existing tags and import new ones from a string