auto focus on text area after hit button
This commit is contained in:
@@ -12,3 +12,7 @@ anytime :
|
|||||||
nodemon server
|
nodemon server
|
||||||
|
|
||||||
- [ ] don't send message to oneself
|
- [ ] 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 ?
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
const add_new_message = (message, from = "others") => {
|
const add_new_message = (message, from = "others") => {
|
||||||
const div_thread = document.getElementById('msg_thread');
|
const div_thread = document.getElementById('msg_thread');
|
||||||
|
|
||||||
console.log("received message:");
|
//console.log("received message:");
|
||||||
console.log(`[${message}]`);
|
//console.log(`[${message}]`);
|
||||||
|
|
||||||
div_thread.appendChild(build_new_message(message, from));
|
div_thread.appendChild(build_new_message(message, from));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
const submit_new_message = () => {
|
const submit_new_message = () => {
|
||||||
|
|
||||||
const div_msg = document.getElementById('msg_write');
|
const div_msg = document.getElementById('msg_write');
|
||||||
/*
|
/*
|
||||||
const msg = div_msg.value;
|
const msg = div_msg.value;
|
||||||
@@ -7,10 +8,11 @@ const submit_new_message = () => {
|
|||||||
*/
|
*/
|
||||||
const msg = div_msg.innerText.trim();
|
const msg = div_msg.innerText.trim();
|
||||||
div_msg.innerText = "";
|
div_msg.innerText = "";
|
||||||
|
div_msg.focus();
|
||||||
|
|
||||||
console.log("msg:");
|
//console.log("msg:");
|
||||||
console.log(`[${msg}]`);
|
//console.log(`[${msg}]`);
|
||||||
console.log(msg.length);
|
//console.log(msg.length);
|
||||||
|
|
||||||
if (msg.length > 0) {
|
if (msg.length > 0) {
|
||||||
socket.emit('chat_message', { data: msg });
|
socket.emit('chat_message', { data: msg });
|
||||||
|
|||||||
@@ -62,6 +62,7 @@
|
|||||||
.chat_box .chat_item.button p {
|
.chat_box .chat_item.button p {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
|
.chat_box .chat_item.button:focus,
|
||||||
.chat_box .chat_item.button:hover {
|
.chat_box .chat_item.button:hover {
|
||||||
background-color: rgb(200, 200, 200);
|
background-color: rgb(200, 200, 200);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user