From: Jo-Philipp Wich Date: Tue, 28 Apr 2020 21:33:24 +0000 (+0200) Subject: luci-mod-system: password.js: make event handler attachment more robust X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=0c556476f057111d8c3fa966b9f9455a763351a6;p=oweals%2Fluci.git luci-mod-system: password.js: make event handler attachment more robust Do not expect a specific markup structure but use querySelector() to locate the input element. Signed-off-by: Jo-Philipp Wich (cherry picked from commit 34c06b4704383428c87e0a3c3c96ff7facfa5c46) --- diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/password.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/password.js index 2b79633ca..a5f1cd9b9 100644 --- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/password.js +++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/password.js @@ -55,7 +55,7 @@ return view.extend({ o.renderWidget = function(/* ... */) { var node = form.Value.prototype.renderWidget.apply(this, arguments); - node.childNodes[1].addEventListener('keydown', function(ev) { + node.querySelector('input').addEventListener('keydown', function(ev) { if (ev.keyCode == 13 && !ev.currentTarget.classList.contains('cbi-input-invalid')) document.querySelector('.cbi-button-save').click(); });