2019-10-15 05:28:56 +00:00
|
|
|
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;
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2019-11-07 07:50:34 +00:00
|
|
|
handleChatForm();
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
$('#action_menu_btn').click(function() {
|
|
|
|
$('.action_menu').toggle();
|
|
|
|
});
|
|
|
|
});
|