mirror of
https://github.com/wahyd4/jQuery-Tags-Input.git
synced 2026-08-09 04:46:44 +10:00
Merge pull request #18 from javiertoledo/master
Mark fake input as not_valid to let users style it on repeated tag
This commit is contained in:
@@ -4,3 +4,4 @@ div.tagsinput span.tag a { font-weight: bold; color: #82ad2b; text-decoration:no
|
||||
div.tagsinput input { width:80px; margin:0px; font-family: helvetica; font-size: 13px; border:1px solid transparent; padding:5px; background: transparent; color: #000; outline:0px; margin-right:5px; margin-bottom:5px; }
|
||||
div.tagsinput div { display:block; float: left; }
|
||||
.tags_clear { clear: both; width: 100%; height: 0px; }
|
||||
.not_valid {background: #FBD8DB !important; color: #90111A !important;}
|
||||
|
||||
@@ -33,6 +33,10 @@
|
||||
|
||||
if (options.unique) {
|
||||
var skipTag = $(tagslist).tagExist(value);
|
||||
if(skipTag == true) {
|
||||
//Marks fake input as not_valid to let styling it
|
||||
$('#'+id+'_tag').addClass('not_valid');
|
||||
}
|
||||
} else {
|
||||
var skipTag = false;
|
||||
}
|
||||
@@ -247,6 +251,14 @@
|
||||
});
|
||||
$(data.fake_input).blur();
|
||||
|
||||
//Removes the not_valid class when user changes the value of the fake input
|
||||
if(data.unique) {
|
||||
$(data.fake_input).keydown(function(event){
|
||||
if(event.keyCode == 8 || String.fromCharCode(event.which).match(/\w+|[áéíóúÁÉÍÓÚñÑ,/]+/)) {
|
||||
$(this).removeClass('not_valid');
|
||||
}
|
||||
});
|
||||
}
|
||||
} // if settings.interactive
|
||||
return false;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user