Keyup event to work once

Hi, from this saved page (the original is protected), in field “Titolo”, I’m trying to associate this symbol * (asterisk) with barspace. This script is working:

const field = document.querySelector('#titoDs')
  field.addEventListener("keyup", (e) => {
if (e.code === 'Space') {
field.value = field.value + " *"};
});

but I would like it to run only once. Looking here I tried to add a

{once: true});

but it doesn’t work. Thanks very much!

Your page isnt binding anything to that box.

Solved with a removeEventListener, thank you!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.