Adding/removing values of "tags" to input

Hi there,

I have this fiddle which adds and removes “tags”. What I would like to do is when a tag is created, it adds it to the value of the input field, but I seem to be getting in a pickle. I tried to add it, but it kept repeating each time I added another one, so I couldn’t get it to just add it once.

Cana anyone help with how to do this? I guess I just need to dynamically add/remove the tag’s content to the input somehow?

Many thanks!

I think we’ll need more information. I see this when I tried to add test twice


Only real flaws I see are:

  • not trimming the tag name so you can add (without the quotes) "test " and “test” and it works.
  • not adding a space between the
  • the rendered new tags should follow the format in your sample, I’d think but it doesn’t.

Thanks for the reply. That is fine having that message as I don’t want duplicate tags/entries. The spacing I can take care of with some CSS, but it’s the functionality I’m struggling with.

I’m trying to create somewhere where the user enters a phrase or keyword, hits enter and it adds it underneath the field. These will appear next to each other, again I can style this, but I can’t get the text the user types in the field.value when it submits.

Sorry, I must be having a severe case of the Fridays because I’m not getting what you’re talking about. I entered the following with an enter after each

  • tag 2
  • tag 3
  • tag 4
  • tag 5
  • tag 6
  • tag 7
  • tag 8
  • tag 9

And got this which looks right, except it removes the tag that was there to start, but only does it the first time :shifty:

Sorry, it’s probably me explaining wrong :confused:

This is what I am trying to do:

Something like this which is another example: