X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=themes%2F_global%2Fjs%2FautoCompleteTags.js;h=986e71d15a22d236609b047b64ad0e7b1e1b1aa8;hb=512ff18015919bf3119509d1a8b8cf87b3b86f5f;hp=90bc982c2080ed61fe42e92b7707dd1f70d3231c;hpb=5e10eee8fc2ccc05f511180a8c92f82de6d293b0;p=github%2Fwallabag%2Fwallabag.git diff --git a/themes/_global/js/autoCompleteTags.js b/themes/_global/js/autoCompleteTags.js index 90bc982c..986e71d1 100755 --- a/themes/_global/js/autoCompleteTags.js +++ b/themes/_global/js/autoCompleteTags.js @@ -43,5 +43,19 @@ jQuery(function($) { } }); + $('.suggestedtag').click(function(){ + var input = $("#value"); + var value = input.val(); + var tag = $(this).text(); + var terms = value.split(','); // tags into the + if (jQuery.inArray(tag, terms) == -1 ) { // if the tag hasn't already been added + value += tag + ","; + input.val(value); + } + input.focus(); + input[0].selectionStart = input[0].selectionEnd = input.val().length; + + }); + });