jstevens13 jstevens13 - 1 year ago 213
Jade Question

Jade conditional (if/else) to add class to div inline

Is there a way to do this inline in a jade template?

if(typeof fromEdit != 'undefined')

Would like to do this conditional check "inline" and the result would add the .in to the end of the div if fromEdit exists.

Answer Source

This works:

div#demo.collapse(class=typeof fromEdit === "undefined" ? "" : "in")

Try it out here.

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