Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flash when duplicate is entered #39

Closed
kritzikratzi opened this issue Oct 14, 2013 · 2 comments
Closed

flash when duplicate is entered #39

kritzikratzi opened this issue Oct 14, 2013 · 2 comments

Comments

@kritzikratzi
Copy link

its sometimes hard to understand why a tag isn't added when you enter a duplicate. i like it when the existing tag quickly flashes so you know its already there.
not posting this as a pull request because i'm sure it could be done in a nicer way.

  // ~ line 80
  if ($.grep(self.itemsArray, function(item) { return self.options.itemValue(item) === itemValue; } )[0]){
    $.each( self.$container.find( ".tag" ), function( i, e ){
      if( self.options.itemValue( $(this).data( "item" ) ) == itemValue ){
        $(this).hide().fadeIn(); 
      }
    } ); 
    return;
  }

best, hansi.

@timschlechter
Copy link
Contributor

Nice addition, I implemented this in a1e07e3 (v0.3.7)

I modified the implementation a bit, so that you provide a function in the options (onTagExists), in which you can handle this situation as you like. Default, I implemented the behaviour you suggested (hide and fadeIn).

@kritzikratzi
Copy link
Author

that was quick. thx, also for the library in general!

aivazoff pushed a commit to aivazoff/bootstrap-tagsinput that referenced this issue Apr 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants