SimpleChat:JS: Try trap enter key press wrt input text field
So user can either press submit button or press enter key
This commit is contained in:
parent
29d2d22c02
commit
e62087bf3f
1 changed files with 7 additions and 0 deletions
|
@ -141,6 +141,13 @@ function startme() {
|
||||||
handle_submit(inputUser, divChat, gChatURL);
|
handle_submit(inputUser, divChat, gChatURL);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
inputUser?.addEventListener("keyup", (ev)=> {
|
||||||
|
if (ev.key === "Enter") {
|
||||||
|
btnSubmit?.click();
|
||||||
|
ev.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue