Button inside jade table cell

Tags: , ,



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

html 
head
body 


table.table.table(border='1')
    thead
        tr 
        th ID 
        th Name
        th Age
        th City
        th Department
    tbody 
    each row in rows 
        tr 
            td=row.id
            td=row.name
            td=row.age
            td=row.city
            td=row.department
            td button(type='submit',onclick='edit("#{row.id}")') Edit

            script.
                function edit(d){
                var val = confirm ("Do you want to edit the record ?");
                if (val==true){
                return true;
                }
                };

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)

thead
    tr 
        th ID 
        th Name
        th Age
        th City
        th Department
        th


Source: stackoverflow