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
button(type='button' class=' c-btn-blue c-btn-circle c-btn-uppercase' value="Read More" onclick='gotoBlog( #{val.link} )')
Error
1:8 Uncaught SyntaxError: Invalid or unexpected token
Changing it to !{val.link}
Error
Uncaught SyntaxError: Unexpected token .
Changing it to "!{val.link}"
and "#{val.link}"
just gives me string understandably so. BTW val.link is a string
Just giving val.link says Uncaught ReferenceError: val is not defined
I am out of options now. Help will be appreciated.
Thanks
Too late but most of the options above didn't work for me but this did
button(onclick='gotoBlog('+'"'+val.link+'"'+')')
or simpler:
onclick=`gotoBlog('${val.link}')`
Basically converts val.link to a string.
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