Skip to content

Instantly share code, notes, and snippets.

@imkost
Created December 5, 2016 19:39
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/a59732d2995a7764623f22460cec0e7b to your computer and use it in GitHub Desktop.
Save imkost/a59732d2995a7764623f22460cec0e7b to your computer and use it in GitHub Desktop.
function App({ url }) {
return `
...
${NameEditor({ id: 0 })}
${NameEditor({ id: 1 })}
${NameEditor({ id: 2 })}
...
`
}
function NameEditor({ id }) {
return `
<div class="nameEditor">
<div>Enter you name:</div>
<input onKeyUp="NameEditor.onKeyUp(this, ${id})" />
<div>
Hello, <span id="nameEditor__name-${id}"></span>
</div>
</div>
`;
}
NameEditor.onKeyUp = (input, id) => {
document.getElementById(`nameEditor__name-${id}`).innerText = input.value;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment