From cd2a5003f1994acafd2dec0efdcc53ef9a9a7ad2 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Tue, 16 Feb 2021 22:39:40 -0500 Subject: [PATCH] Only update SMS preview when the textarea updates Apparently `.on` expects a string selector. --- cmd/server/assets/realmadmin/_form_sms.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cmd/server/assets/realmadmin/_form_sms.html b/cmd/server/assets/realmadmin/_form_sms.html index 524a524ad..96abf05a4 100644 --- a/cmd/server/assets/realmadmin/_form_sms.html +++ b/cmd/server/assets/realmadmin/_form_sms.html @@ -403,13 +403,12 @@ } // When the textarea changes, rebuild the splits. - const $templates = $('textarea.sms-text-template'); - $(document).on('keyup', $templates, function(e) { + $(document).on('keyup', 'textarea.sms-text-template', function(e) { buildTemplateSplits(e.target); }); // On initial page load, build the split. - buildTemplateSplits($templates[0]); + buildTemplateSplits($('textarea.sms-text-template')[0]); // // SMS templates builder