skwz,
{
let classNamesRE = /^(?:start|stop|status)$/;
let input = document.getElementById("my-field");
let div = document.querySelector(".sos");
let onInputHandler = event => {
let val = event.target.value.trim();
let match = event.code === "Enter" && val ? (val.match(classNamesRE)||"error") : "";
event.target.className = div.className = "sos " + match;
};
input.addEventListener("keyup", onInputHandler);
};