Chong Lip Phang
Chong Lip Phang

Reputation: 9279

How to display tags in a HTML textbox?

I am rather curious.

When a member is asking a question in Stack Overflow, within a textbox, the member can enter tags which will change into a graphical form automatically. There is even an 'X' button to the side of each tag which will allow the tag to be deleted.

How is this implemented in HTML? I thought only pure text is allowed in a textbox.

enter image description here enter image description here

Upvotes: 0

Views: 2104

Answers (3)

Latheesan
Latheesan

Reputation: 24116

The tag system is quite easy to do with a jquery library. Check these out:

and so on ...

Upvotes: 1

pimmey
pimmey

Reputation: 461

Only text is allowed in a textfield, you're right.

The Tags field, when you're asking a question on this site, is actually a <div> which looks like a textfield. Then, it's a matter of CSS and JavaScript to manage inserting and removing the tags. You could use web-inspector to study the HTML structure and css/js codes.

Upvotes: 1

asdf_enel_hak
asdf_enel_hak

Reputation: 7640

Viewing source of the tags may give some idea:

enter image description here

Upvotes: 0

Related Questions