How can I link a button in jade template? I am trying to generate the HTML
<a href="create"><button type="button">create new post</button></a>
I tried
a(href="create") button "create new post"
which results in
<a href="create">button "create new post"</a>
If I change it to
a(href="create")button "create new post"
I get the error
logJs\views\posts\update.jade:7 5| block content 6| h1='creating new post' > 7| a(href="create")button "hello word" 8| form(name="add-post",method="post") 9| div.input 10| span.label title Unexpected token `tag` expected `text`, `code`, `:`, `newline` or `eos`
You just need to use a separate line and the correct indentation. The jade code
a(href="create")
button(type="button") create new post
results in
<a href="create"><button type="button">create new post</button></a>
One more solution:
a(href="create"): button(type="button") create new post
It will work for you too!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With