From 6d8d9d9a4fc3eb21016f589be68a4e5054bd7cd9 Mon Sep 17 00:00:00 2001 From: Ben Brown Date: Wed, 11 Apr 2012 15:22:57 -0500 Subject: [PATCH] Fix bug in tagExist --- jquery.tagsinput.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jquery.tagsinput.js b/jquery.tagsinput.js index 399d1c7..513c635 100644 --- a/jquery.tagsinput.js +++ b/jquery.tagsinput.js @@ -186,7 +186,10 @@ }; $.fn.tagExist = function(val) { - return (jQuery.inArray(val, $(this)) >= 0); //true when tag exists, false when not + + var settings = $(this).data('settings'); + var tagslist = $(this).val().split(settings.delimiter); + return (jQuery.inArray(val, tagslist) >= 0); //true when tag exists, false when not }; // clear all existing tags and import new ones from a string