-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrud.js
More file actions
43 lines (39 loc) · 1.19 KB
/
crud.js
File metadata and controls
43 lines (39 loc) · 1.19 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
document.querySelector("#salvar").addEventListener("click", cadastrar)
function cadastrar() {
let titulo = document.querySelector("#titulo").value
let descricao = document.querySelector("#descricao").value
let pontos = document.querySelector("#pontos").value
let categoria = document.querySelector("#categoria").value
const tarefa = {
titulo,
descricao,
pontos,
categoria
}
document.querySelector("#tarefas").innerHTML += gerarCard(tarefa)
console.log(titulo, descricao, pontos, categoria)
}
function gerarCard(tarefa){
return `
<div class="col-12 col-md-6 col-lg-3">
<div class="card">
<div class="card-header">
${tarefa.titulo}
</div>
<div class="card-body">
<p class="card-text"> ${tarefa.descricao}</p>
<P>
<span class="badge text-bg-dark">${tarefa.categoria}</span>
</P>
<p>${tarefa.pontos}pts</p>
<a href="#" class="btn btn-success">
<i class="bi bi-check2-square"></i>
</a>
<a href="#" class="btn btn-danger">
<i class="bi bi-check2-square"></i>
</a>
</div>
</div>
</div>`
}
console.log()