Skip to content

Instantly share code, notes, and snippets.

@imkost
Created December 5, 2016 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imkost/b0de13d91429010cdff0a4e966da1ab2 to your computer and use it in GitHub Desktop.
Save imkost/b0de13d91429010cdff0a4e966da1ab2 to your computer and use it in GitHub Desktop.
const nameElems = {};
function getNameElems(id) {
return nameElems[id] || (
nameElems[id] = document.getElementsByClassName(`nameEditor__name-${id}`)
);
}
NameEditor.onKeyUp = (input, id) => {
for (const elem of getNameElems(id)) {
elem.innerText = input.value;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment