How to add a tag text input system similar to StackOverflows system
Can I just draw text inside the box? The system I came up with was:
- Make a Div that applies a checkbox
- When typing in a field, listen for a space
- When space is supplied, add it to the array, which then adds it to the list of tags that will be displayed in the div
- When divs width
>
than input field, limit width to set size - When adding more tags than the width allows, push the new tag into the array, scroll to the end of the div and hide the other tags overflow
- Listen if the text box is empty and the backspace key is pressed.
- If clicked, fill the text box with the text of the last element in the array and concatenate the last element to remove it.
This is the current method I mean to implement and can code it easily. But I was wondering if there is an easier way to do this and more in the browser / version. I've tried StackOverflows tagging system, tags, tags and more, but these are all really unrelated things. Any input would be nice sorry if this is a bad question I can delete it or vote to close it if needed. Thank.
+3
source to share