Textual feedback for personal colour

pull/8/head
Charlotte Som 2022-04-29 23:41:33 +01:00
parent 8e19d7b34d
commit 0fc8953a69
1 changed files with 16 additions and 1 deletions

View File

@ -30,7 +30,9 @@
required
/>
<label for="join-session-colour">Personal Colour:</label>
<label id="join-session-colour-label" for="join-session-colour">
Personal Colour:
</label>
<input type="color" id="join-session-colour" value="#ffffff" required />
<label for="join-session-id">Session ID:</label>
@ -65,5 +67,18 @@
</div>
<script type="module" src="/main.mjs?v=bfdcf2"></script>
<script>
const updateColourLabel = () => {
const colour = document.querySelector("#join-session-colour").value;
document.querySelector(
"#join-session-colour-label"
).textContent = `Personal Colour: ${colour}`;
};
document
.querySelector("#join-session-colour")
.addEventListener("input", updateColourLabel);
updateColourLabel();
</script>
</body>
</html>