From 04189f7e7c4af3d3fa9074e52391b1f9e548c942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolphe=20Br=C3=A9ard?= Date: Tue, 25 Jul 2023 23:11:03 +0200 Subject: [PATCH] Clean previously generated address --- pwa/app.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pwa/app.js b/pwa/app.js index b60f77b..b6395dd 100644 --- a/pwa/app.js +++ b/pwa/app.js @@ -175,6 +175,13 @@ document.addEventListener('DOMContentLoaded', () => { document.querySelector('#generated-addr').value = new_address; console.log(`New sub-address for account ${account.getName()}: ${new_address}`); }); + + // Add a change event on the main form to remove previously generated address + ['#account-name', '#sub-addr-name'].forEach((selector) => { + document.querySelector(selector).addEventListener('change', () => { + document.querySelector('#generated-addr').value = ''; + }); + }); }); window.addEventListener('load', () => {