开发者

Comparison of js andtemplate tags

<script>
function compare(profile_id)
{
{% ifequal '{{profile.id}}'  %}
  selected_sub='selected';
{% endife开发者_开发知识库qual %}
}
</script>

How to compare {{profile.id}} and javascript variable profile_id


function compare(profile_id){
    if (profile_id == {{ profilegroup.subject.id }})
        \\ do something
}

Keep in mind, that the script must be in a template, not in some served statically file with scripts (it must be filled with values, to work). Remember also, that you simply have templated script, that gets filled, when the response is generated and it will have exactly one value (for the profilegroup passed to the template).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜