Something like this?
JavaScript: $(function(){ $("span.tag").click(function(){ var input = $("input.tagtext"); if (input.val().search(new RegExp("\\b"+$(this).text()+"\\b","i"))===-1) { input.val(input.val()+" "+$(this).text()); } return false; }); }); HTML: <input type="text" name="tagtext" class="tagtext"/> <span class="tag">javascript</span> <span class="tag">jquery</span> <span class="tag">resig</span> <span class="tag">dhtml</span> <span class="tag">java</span> I've got a working version here: http://dev.jakemcgraw.com/tags/ This version won't allow double entries, uses RegExp object. - jake On 5/14/07, jquery newbie <[EMAIL PROTECTED]> wrote:
hi - i need to implement del.icio.us style tagging mechanism. that involves a list of hyperlinked keywords that when clicked add or remove or their text to an inputbox and inputbox supporting autosuggest for each of the words after the separation character. i am surprised to see that it is not already implemented since most web 2.0 applications implement one form of tagging or another. if someone can tell me how to add or remove a text to an input field using jquery, i can get the ball rolling. thanks.