summaryrefslogtreecommitdiff
path: root/assets/js/components/autocomplete-email.js
diff options
context:
space:
mode:
Diffstat (limited to 'assets/js/components/autocomplete-email.js')
-rw-r--r--assets/js/components/autocomplete-email.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/assets/js/components/autocomplete-email.js b/assets/js/components/autocomplete-email.js
index 9d337e03..8e46e1d3 100644
--- a/assets/js/components/autocomplete-email.js
+++ b/assets/js/components/autocomplete-email.js
@@ -1,9 +1,15 @@
KB.onClick('.js-autocomplete-email', function (e) {
- var email = KB.dom(e.target).data('email');
- var emailField = KB.find('.js-mail-form input[type="email"]');
+ var email = e.target.dataset.email;
+ var emailField = document.querySelector('.js-mail-form input[name="emails"]');
- if (email && emailField) {
- emailField.build().value = email;
+ if (!email || !emailField) {
+ return;
+ }
+
+ if (emailField.value !== '') {
+ emailField.value += ', ' + email;
+ } else {
+ emailField.value = email;
}
_KB.controllers.Dropdown.close();