aboutsummaryrefslogtreecommitdiffhomepage
path: root/themes/_global/js/autoCompleteTags.js
diff options
context:
space:
mode:
Diffstat (limited to 'themes/_global/js/autoCompleteTags.js')
-rwxr-xr-xthemes/_global/js/autoCompleteTags.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/themes/_global/js/autoCompleteTags.js b/themes/_global/js/autoCompleteTags.js
index 90bc982c..8b32f8ca 100755
--- a/themes/_global/js/autoCompleteTags.js
+++ b/themes/_global/js/autoCompleteTags.js
@@ -43,5 +43,22 @@ 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 $(".alreadytagged").each(function(index) {
52 terms.push($(this).text() );
53 });
54 if (jQuery.inArray(tag, terms) == -1 ) { // if the tag hasn't already been added
55 value += tag + ",";
56 input.val(value);
57 }
58 input.focus();
59 input[0].selectionStart = input[0].selectionEnd = input.val().length;
60
61 });
62
46 63
47}); 64});