diff options
Diffstat (limited to 'themes/_global/js')
-rwxr-xr-x | themes/_global/js/autoCompleteTags.js | 14 |
1 files changed, 14 insertions, 0 deletions
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($) { | |||
43 | } | 43 | } |
44 | }); | 44 | }); |
45 | 45 | ||
46 | $('.suggestedtag').click(function(){ | ||
47 | var input = $("#value"); | ||
48 | var value = input.val(); | ||
49 | var tag = $(this).text(); | ||
50 | var terms = value.split(','); // tags into the <input> | ||
51 | if (jQuery.inArray(tag, terms) == -1 ) { // if the tag hasn't already been added | ||
52 | value += tag + ","; | ||
53 | input.val(value); | ||
54 | } | ||
55 | input.focus(); | ||
56 | input[0].selectionStart = input[0].selectionEnd = input.val().length; | ||
57 | |||
58 | }); | ||
59 | |||
46 | 60 | ||
47 | }); | 61 | }); |