I want to add a button to shown in each row of the table, But the button does not appear cant figure out why. I’m new to jade and node js
Jade file
JavaScript
x
31
31
1
html
2
head
3
body
4
5
6
table.table.table(border='1')
7
thead
8
tr
9
th ID
10
th Name
11
th Age
12
th City
13
th Department
14
tbody
15
each row in rows
16
tr
17
td=row.id
18
td=row.name
19
td=row.age
20
td=row.city
21
td=row.department
22
td button(type='submit',onclick='edit("#{row.id}")') Edit
23
24
script.
25
function edit(d){
26
var val = confirm ("Do you want to edit the record ?");
27
if (val==true){
28
return true;
29
}
30
};
31
Advertisement
Answer
you are not indenting your th’s correctly (they need to be indented relative to the tr that they are in) and you need to include an empty one (or set a colspan = 2″on the last th) to accommodate the td that the edit button requires)
JavaScript
1
9
1
thead
2
tr
3
th ID
4
th Name
5
th Age
6
th City
7
th Department
8
th
9