Arianule
Arianule

Reputation: 9043

syntax error, jquery templates

I am trying to use the modulus operator with jquery templates but get a syntax error

Uncaught SyntaxError: Unexpected token { 

{{if Items.length > 0}}
    <div>
        <table class='table table-bordered' style='width:450px;'>
            <thead style='text-align:center;'>
            <td>
                <strong>Related Topics</strong>
            </td>
            </thead>
            {{each Items}}
             {{if ${$index} % 6===0}}
                <td>
                        <input type='hidden' name='subUniqueKey${DomainObjectUniqueKey}' value='${DomainObjectUniqueKey}' />
                        <input type='checkbox' name='chkTopics${DomainObjectUniqueKey}'/><label id='labRelTopicsDisplay${DomainObjectUniqueKey}'>${subject}</label>  
                </td>
             {{/if}}
        {{/each}}
      </table>
    </div>
{{/if}}

Advice perhaps as to where the error lies

thanks

Upvotes: 0

Views: 37

Answers (1)

Farhan
Farhan

Reputation: 752

I think this is the part causing error

{{if ${$index} % 6===0}}

Try to change it to

{{if $index % 6===0}}

Upvotes: 1

Related Questions