Search code examples
jqueryjquery-templates

Why does jquery tmpl not parse my {{ if }}?


I have a jquery template containing an if but it won't evaluate the if - it just outputs the value as-is. I have found several examples and documentation showing that this should work.

What am i doing wrong?

http://jsfiddle.net/G4J5u/


Solution

  • You have extra space in the template tags:

    Yours:

    {{ if disabled}}disabled{{ /if }}
    

    Correct:

    {{if disabled}}disabled{{/if}}
    

    Tested it on JSFiddle.