-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathscript.js
More file actions
40 lines (32 loc) · 1.28 KB
/
script.js
File metadata and controls
40 lines (32 loc) · 1.28 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
function exibirDados (event) {
event.preventDefault();
let pegaAutor = document.getElementById('autor').value;
let pegaTítulo = document.querySelector('#titulo').value;
let pegaISBN = document.querySelector('#isbn').value;
let pegaPaginas = document.querySelector('#paginas').value;
let pegaDataPublicacao = document.getElementById('dataPublicacao').value;
let dataInsercao = new Date().toLocaleDateString('pt-br');
let horarioInsercao = new Date().toLocaleTimeString('pt-br');
document.getElementById('resposta').innerHTML += `
<tr id="tabelaDeLivro">
<td>${pegaTítulo}</td>
<td>${pegaAutor}</td>
<td>${pegaISBN}</td>
<td>${pegaDataPublicacao}</td>
<td>${pegaPaginas}</td>
<td>${dataInsercao}, ${horarioInsercao}</td>
</tr>
`
limpardados()
}
function limpardados () {
document.getElementById('titulo').value="";
document.getElementById('autor').value="";
document.getElementById('isbn').value="";
document.getElementById('dataPublicacao').value="";
document.getElementById('paginas').value="";
}
document.querySelector("#botaoDelete").addEventListener('click', function exluirLivro (event) {
event.preventDefault();
document.getElementById('tabelaDeLivro').remove();
})