开发者

Comparison of js andtemplate tags

开发者 https://www.devze.com 2023-01-12 12:54 出处:网络
<script> function compare(profile_id) { {% ifequal \'{{profile.id}}\'%} selected_sub=\'selected\'; {% endife开发者_开发知识库qual %}
<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

精彩评论

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