lundi 22 décembre 2014

How can I add a tag text input system similar to StackOverflows system


Is it possible to just style the text inside the box? The system I had came up with was:



  1. Make a Div that overlays the box

  2. When typing in the box listen for spacebar

  3. When spacebar is pushed, add it to an array, which then adds it to the list of Tags to appear in the div

  4. When the divs width is > than the input box, limit the width to a set size

  5. When adding more tags than the width allows, push new tag to array, scroll the div to the end and hide the overflow of the other tags

  6. Listen for if the text box is empty and backspace is pressed

  7. If pressed, populate the text box with the text of the last element in the array, and splice the last element to remove it.


This is the current method I mean to implement and can code it just fine. But I was wondering if there is a simpler way to do this and more cross browser / version friendly. I tried googling StackOverflows tag system, tags, tagging, and more but it's all really unrelated stuff. Any input would be nice sorry if this is a poor question, I can delete it or vote to close it if necessary. Thanks.





Aucun commentaire:

Enregistrer un commentaire