--- tag_complete/tag_complete.js 2006/08/18 22:59:04 46 +++ tag_complete/tag_complete.js 2006/08/18 23:10:48 48 @@ -69,13 +69,19 @@ return true; } - $.log.info('take suggestion: '+s); + _tag.add_tag( s ); + _tag.clean_selected(); + return false; + }, + + add_tag: function( t ) { + $.log.info('add: '+t); $('#tags').val( $('#tags').val().replace( - /[^ ]*$/, s + ' ' + /[^ ]*$/, t + ' ' ) ); - _tag.clean_selected(); + _tag.focus(); return false; }, @@ -113,8 +119,12 @@ $(document).ready( function() { $('.tag').each( function(i) { - _tag.name[i] = this.firstChild.nodeValue; + var n = this.firstChild.nodeValue; + _tag.name[i] = n; _tag.obj[i] = this; + this.onclick = function() { + return _tag.add_tag( n ); + } }); $.log.info( 'found ' + _tag.name.length + ' tags' );