From 433d09e808bf64e630b64c20624b88338f85e583 Mon Sep 17 00:00:00 2001 From: Matthew Wire <mjw@mjwconsult.co.uk> Date: Wed, 5 Feb 2020 14:15:28 +0000 Subject: [PATCH] Switch to event.code from deprecated event.keyCode --- js/civicrm_stripe.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/js/civicrm_stripe.js b/js/civicrm_stripe.js index c695e920..2a54a785 100644 --- a/js/civicrm_stripe.js +++ b/js/civicrm_stripe.js @@ -321,8 +321,8 @@ CRM.$(function($) { addDrupalWebformActionElement(this.value); }); // If enter pressed, use our submit function - form.addEventListener('keydown', function (e) { - if (e.keyCode === 13) { + form.addEventListener('keydown', function (event) { + if (event.code === 'Enter') { addDrupalWebformActionElement(this.value); submit(event); } @@ -588,9 +588,9 @@ CRM.$(function($) { function addSupportForCiviDiscount() { // Add a keypress handler to set flag if enter is pressed cividiscountElements = form.querySelectorAll('input#discountcode'); - var cividiscountHandleKeydown = function(e) { - if (e.keyCode === 13) { - e.preventDefault(); + var cividiscountHandleKeydown = function(event) { + if (event.code === 'Enter') { + event.preventDefault(); debugging('adding submitdontprocess'); form.dataset.submitdontprocess = true; } -- GitLab