So I am using a javascript object to render a list of items. My object looks like this:
{
text: 'One',
url: 'index.pug'
},
{
text: 'Two',
url: 'Two.pug'
},
{
text: 'Three',
url: 'Three.pug'
}
}
The interesting part is when pug renders them. I am rendering them using something like this:
div
ul.horizontalScroll
each item in params.apps
li
a(onclick="loadXMLDoc(#{item.url})") #{item.text}
What I cannot figure out is why item.text renders correctly, but on click the link doesn't ping the function. In chrome inspector, I saw this:<a onclick="loadXMLDoc(#)">One </a>
. Why is the argument not coming through as index.pug
like it should??
Pugs are known for making wonderful pets for all kinds of people and home environments. They are friendly dogs that get along well with everyone, including strangers, so don't count on a pug to be a good guard dog. They are mischievous dogs that are highly adaptable and loving.
The research also showed pugs have a reduced risk of some conditions, including heart murmur, aggression and wounds. But researchers suggest their findings indicate many pugs may suffer from seriously compromised health and welfare.
The pug was selectively bred to feature an extremely flat face, which contributes to breathing difficulties and eye injuries. Disorders like hip dysplasia, commonly seen in large purebreds, such as German Shepherds have emerged due to the breeder's desire for a sloping back.
Pugs are ideal for families with children, as they are generally patient with children and love to play games. The shape of their mouth prevents them from biting efficiently, and this makes them reasonably harmless. Pugs are among the most gentle and passive of all breeds.
Try concatenating the variable within the attribute:
a(onclick="loadXMLDoc('" + item.url + "')") #{item.text}
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