-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
50 lines (35 loc) · 1.17 KB
/
script.js
File metadata and controls
50 lines (35 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//Para el envio del mensaje
$("form").on("submit", function (e) {
e.preventDefault();
let inputValue = $(".messageBox").val();
if (inputValue.length > 0) {
//Arreglo para mensajes
const arrayMsg = [
{
user: "Thomas Anderson",
pic: "url",
time: "14:30",
text: inputValue,
},
];
//Imprimir mensajes
const msgContainer = $(".wrap");
function printMessage() {
arrayMsg.forEach((element) => {
const msgFormat = `<div class="msgBox">
<div class="picUser"></div>
<div class="content">
<div class="data">
<div class="name">${element.user}</div>
<div class="timeStamp"> 11:05</div>
</div>
<div class="text">${element.text}</div>
</div>
</div>`;
msgContainer.append(msgFormat);
});
}
printMessage();
let = $(".messageBox").val("");
}
});