In my site, I would like to implement a textbox where people can input a set of strings separated by a separator character.
For example the tags textbox at the bottom of this page: tags(strings) delimited by space(separator).
To make it more clear to the user, it would make a lot of sence to give each string a different background color or other visual hint.
I don’t think this is possible with a regular input[text] control.
Do you deem it possible to create something like that with javascript? Has somebody done this before me already? Do you have any other suggestions?
Basic Steps
Tis quite straightforward. I’ll leave you to write your formatter but basically you’d just splitString on separator as per the Semi-Working-Example.
Simple Outline
Semi-Working Example
You still need to extend the click handlers to account for tag deletion/editing/backspacing/etc via keyboard…. or you could just use a click event to pop up another context menu div. But with tags and spacer ids identified in the code below that should be pretty easy:
Cursor
You could CSS the cursor using blink (check support) or otherwise just advance and hide as necessary an animated gif.