2

How can I build a tag text box thing like here on Stack Overflow using Ruby on Rails?

Also, how do I handle the form post scenarios once the tags are submitted?

rene
  • 41,474
  • 78
  • 114
  • 152
Sagar
  • 1,727
  • 4
  • 22
  • 30

2 Answers2

4

If you will take a look on the tags on Stack Overflow - it's just an anchor with span inside for removing it. And of course, you need to style it.

<a href="#">My Tag
    <span>X</span>
</a>

As for posting the form: Use jQuery and an Ajax request to post it to the server. More information is in jQuery.ajax().

Source code for a demo is at http://jsfiddle.net/Fj3zx/6/.

Also check out the Choosen plugin for jQuery.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Samich
  • 29,157
  • 6
  • 68
  • 77
4

The Meta Stack Overflow question Can I use the tag textbox script? might help.

It points people towards the plug-in Chosen.

Community
  • 1
  • 1
ipr101
  • 24,096
  • 8
  • 59
  • 61