auto focus on text area after hit button

This commit is contained in:
lenovo
2022-11-30 19:50:10 +01:00
parent 9aec5bd015
commit 7020b6b67e
4 changed files with 12 additions and 5 deletions

View File

@@ -12,3 +12,7 @@ anytime :
nodemon server
- [ ] don't send message to oneself
- [ ] create a room
- [ ] automatically add someone to a room
- [ ] being able to accept or refuse to be added to a room
- [ ] what to do with message not received ?

View File

@@ -2,8 +2,8 @@
const add_new_message = (message, from = "others") => {
const div_thread = document.getElementById('msg_thread');
console.log("received message:");
console.log(`[${message}]`);
//console.log("received message:");
//console.log(`[${message}]`);
div_thread.appendChild(build_new_message(message, from));
}

View File

@@ -1,5 +1,6 @@
const submit_new_message = () => {
const div_msg = document.getElementById('msg_write');
/*
const msg = div_msg.value;
@@ -7,10 +8,11 @@ const submit_new_message = () => {
*/
const msg = div_msg.innerText.trim();
div_msg.innerText = "";
div_msg.focus();
console.log("msg:");
console.log(`[${msg}]`);
console.log(msg.length);
//console.log("msg:");
//console.log(`[${msg}]`);
//console.log(msg.length);
if (msg.length > 0) {
socket.emit('chat_message', { data: msg });

View File

@@ -62,6 +62,7 @@
.chat_box .chat_item.button p {
margin: auto;
}
.chat_box .chat_item.button:focus,
.chat_box .chat_item.button:hover {
background-color: rgb(200, 200, 200);
}