How to access Javascript variable inside Jtemplate?
Posted
by user330547
on Stack Overflow
See other posts from Stack Overflow
or by user330547
Published on 2010-05-01T20:46:51Z
Indexed on
2010/05/01
20:47 UTC
Read the original article
Hit count: 409
jtemplate
function(result)
{
var lParsedResult = result.d;
var userTyp = "test"; //getting this value from some other source
$("#accountList").setTemplate($("#accountListTemplate").html());
$("#accountList").processTemplate(lParsedResult);
}
<div id="accountList">
<script type="text/html" id="accountListTemplate" >
{#foreach $T as account}
<div {#if userTyp == "test"} style="display: inline" {#else} style="display: none" {#/if}>
<p>othere info</p>
</div>
{#/for}
</div>
I want to hide a block if the user type = "test". appreciate your help
Thanks, Mathew.
© Stack Overflow or respective owner