Jamgreen Jamgreen - 1 year ago 99
Jade Question

Element with id inside another element in jade/pug

I use

and I have this code

span <span id='numClients'>0</span> clients

So I want it to output

<span><span id="numClients">0</span> clients</span>

and it does work, but it's not pretty jade. How do you normally do this?

I could eventually use

span(id='numClients) 0
span clients

but it's not quite the same.

Answer Source

This is how you do it in jade/pug way.

    #[span#numClients 0] clients

This is called tag interpolation

Here's a documentation coming from jade/pug https://pugjs.org/language/interpolation.html

Hope it helps. Cheers!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download