disable join button on first click
This commit is contained in:
parent
7a035c5a98
commit
a69f0f7318
3 changed files with 11 additions and 10 deletions
|
@ -36,7 +36,7 @@
|
|||
placeholder="123e4567-e89b-12d3-a456-426614174000"
|
||||
required
|
||||
/>
|
||||
<button>Join</button>
|
||||
<button id="join-session-button">Join</button>
|
||||
</form>
|
||||
|
||||
<p>
|
||||
|
@ -52,6 +52,6 @@
|
|||
</form>
|
||||
</div>
|
||||
|
||||
<script type="module" src="/main.mjs?v=3"></script>
|
||||
<script type="module" src="/main.mjs?v=4"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -37,6 +37,7 @@ export const setupJoinSessionForm = () => {
|
|||
const form = document.querySelector("#join-session-form");
|
||||
const nickname = form.querySelector("#join-session-nickname");
|
||||
const sessionId = form.querySelector("#join-session-id");
|
||||
const button = form.querySelector("#join-session-button");
|
||||
|
||||
loadNickname(nickname);
|
||||
|
||||
|
@ -44,12 +45,12 @@ export const setupJoinSessionForm = () => {
|
|||
sessionId.value = window.location.hash.substring(1);
|
||||
}
|
||||
|
||||
document
|
||||
.querySelector("#join-session-form")
|
||||
.addEventListener("submit", (event) => {
|
||||
event.preventDefault();
|
||||
form.addEventListener("submit", (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
saveNickname(nickname);
|
||||
joinSession(nickname.value, sessionId.value);
|
||||
});
|
||||
button.disabled = true;
|
||||
|
||||
saveNickname(nickname);
|
||||
joinSession(nickname.value, sessionId.value);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { setupJoinSessionForm } from "./lib/join-session.mjs?v=3";
|
||||
import { setupJoinSessionForm } from "./lib/join-session.mjs?v=4";
|
||||
|
||||
const main = () => {
|
||||
setupJoinSessionForm();
|
||||
|
|
Loading…
Reference in a new issue