You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
806 B
22 lines
806 B
var chatTextArea = document.getElementById('chatTextArea');
|
|
function handleChatForm() {
|
|
let chatInput = document.getElementById('chatInput');
|
|
let myForm = document.getElementById('chatMessageForm').addEventListener(
|
|
'submit', function (e) {
|
|
e.preventDefault();
|
|
|
|
// let user = getSelectedUser();
|
|
// if (!isCheckedUser) {
|
|
// window.alert('please select a user');
|
|
// return;
|
|
// }
|
|
// console.log('second user = ' + user);
|
|
let messageContent = chatInput.value;
|
|
let localDate = new Date();
|
|
let messageLine = localDate.toLocaleDateString() + localDate.toLocaleTimeString() + 'fromUser' + ': ' + messageContent;
|
|
chatTextArea.append(messageLine + "\n");
|
|
chatTextArea.scrollTop = chatTextArea.scrollHeight;
|
|
})
|
|
}
|
|
|
|
handleChatForm();
|