mirror of
https://github.com/wahyd4/jQuery-Tags-Input.git
synced 2026-08-09 04:46:44 +10:00
Merge pull request #51 from tybulewicz/master
Fixed issue #49 - tagExist() now works correctly
This commit is contained in:
+4
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user