From 6f5018d45ea254f6ed9ea92914608c966d78086a Mon Sep 17 00:00:00 2001 From: j433866 Date: Thu, 16 May 2019 11:59:25 +0100 Subject: [PATCH] Don't change option value if new value is blank --- src/web/HTMLIngredient.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/web/HTMLIngredient.mjs b/src/web/HTMLIngredient.mjs index d8ac9511..c996c51d 100755 --- a/src/web/HTMLIngredient.mjs +++ b/src/web/HTMLIngredient.mjs @@ -293,7 +293,9 @@ class HTMLIngredient { const op = el.parentNode.parentNode; const target = op.querySelectorAll(".arg")[this.target]; - target.value = el.childNodes[el.selectedIndex].getAttribute("populate-value"); + const popVal = el.childNodes[el.selectedIndex].getAttribute("populate-value"); + if (popVal !== "") target.value = popVal; + const evt = new Event("change"); target.dispatchEvent(evt);