Betty
Betty

Reputation: 572

javascript library / jquery plugin that enables me to click on a list of tags to input them

I've searched a lot and all the tag input plugins I can find are like this one: http://xoxco.com/projects/code/tagsinput/

You can type in the input box and it wraps the tags in nice styles and offers auto-completion and stuff.

But what I want is this:

I have a list of recommendated tags. The plugin makes the tags clickable. When I click on one tag, the tag goes into the input box. When I click on the tag again, the tag is removed from the input box.

Of course, the input box still needs to function as a normal input box, i.e., I can still type in it.

It's like the tagging on https://delicious.com/ and http://diigo.com/.

Is there a plugin to do this?

Upvotes: 0

Views: 106

Answers (1)

jikey
jikey

Reputation: 394

You want this effect? this effect no jquery method,this is js code.

demo here

var navs = document.getElementById('nav').getElementsByTagName('li');
var tmp = navs[navs.length-1];
for(var i=0; i<navs.length; i++){
    navs[i].onclick = function(){
        tmp.className = '';
        this.className = 'current';
        tmp = this;
    }
}

Upvotes: 1

Related Questions