Can I declare local/temp variables within a jQuery template?

后端 未结 2 1352
青春惊慌失措
青春惊慌失措 2020-12-30 04:50

Is it possible to declare new variables within the jQuery template syntax? I\'m hoping to achieve the equivalent of this (which does not work):

{{var test =          


        
2条回答
  •  执笔经年
    2020-12-30 05:31

    I know this has already been answered and accepted, but here is another solution:

    ${( $data.localVariable = 'SOMETHING' ),''}
    

    A jsFiddle example: http://jsfiddle.net/brettwp/PrfZ5/

提交回复
热议问题