Button is not getting inserted inside table row in Pug

2908 views node.js
-3

I am trying to add the button as row element in Pug table. But button is not getting inserted at specific row following is the pug code

table
    tr#headtag
        th DishName
        th Quantity
        th Currently_Done
        th Predicted
        th 
    each order in orders
        tr
            th=order.dish.name
            th=order.numberOfQuantity
            th=order.dish.predictedValue
            th=order.dish.predictedValue
            th=button(class="btn btn-small", type="button") Slett

Getting 'Something failed error' in browser

Without button code is working fine.

table
    tr#headtag
        th DishName
        th Quantity
        th Currently_Done
        th Predicted
    each order in orders
        tr
            th=order.dish.name
            th=order.numberOfQuantity
            th=order.dish.predictedValue
            th=order.dish.predictedValue

answered question

1 Answer

2

Remove = before button and , (optional) between class and type and try the following instead:

th
    button(class="btn btn-small" type="button") Slett

From the docs:

Buffered code starts with =. It evaluates the JavaScript expression and outputs the result. For security, buffered code is first HTML escaped.

Therefore th=button(class="btn btn-small", type="button") Slett won't work.

posted this

Have an answer?

JD

Please login first before posting an answer.