How to pass value to a onclick function in (Jade)pug?

前端 未结 8 1627
长情又很酷
长情又很酷 2021-01-02 10:54

I am new to jade and stuck on this issue. I think I have tried everything from the StackOverflow posts and still at nothing.

The things I have tried



        
8条回答
  •  时光取名叫无心
    2021-01-02 11:12

    You just need to put onclick="myfunction(#{varible.atributo})"

    Here a example:

    table
    thead
        tr
            th #ID
            th Description
            th Actions
    tbody
        each item, i in itemlist
            tr
                th(scope='row') #{item.id}
                td #{item.description}
                td
                    button(onclick="editItem(#{item.id})", title="Edit")
                        |  Edit
    

提交回复
热议问题