Add autofocus

This commit is contained in:
Quentin ANIERE 2022-04-14 15:39:24 +02:00
parent 5fdbde912b
commit bab5bc8318
2 changed files with 3 additions and 2 deletions

View File

@ -53,7 +53,7 @@
<ul id="messages"> <ul id="messages">
<li><b>Rappel:</b> Tous les messages doivent parler de Denis !</li> <li><b>Rappel:</b> Tous les messages doivent parler de Denis !</li>
</ul> </ul>
<input id="message-input" type="text" placeholder="Écrivez votre message sur Denis ici..."> <input id="message-input" type="text" placeholder="Écrivez votre message sur Denis ici..." autofocus>
<img id="send" src="./images/send.png"> <img id="send" src="./images/send.png">
<img id="close" src="./images/cross.png"> <img id="close" src="./images/cross.png">
</div> </div>

View File

@ -29,7 +29,7 @@ document.addEventListener("DOMContentLoaded", () => {
}); });
socket.on("new-message", (data) => { socket.on("new-message", (data) => {
if(data.author != username) { if(data.author != username) {
document.getElementById("ringtone").play(); document.getElementById("ringtone").play();
} }
@ -65,6 +65,7 @@ const swiper = new Swiper('.swiper', {
document.getElementById("chat-button").addEventListener("click", () => { document.getElementById("chat-button").addEventListener("click", () => {
document.getElementById("chat").style.display = "block"; document.getElementById("chat").style.display = "block";
document.getElementById("message-input").focus();
}); });
document.getElementById("close").addEventListener("click", () => { document.getElementById("close").addEventListener("click", () => {