Templated attributes?

7 views
Skip to first unread message

Alexis Smirnov

unread,
May 22, 2008, 10:16:45 PM5/22/08
to google-jstemplate
Hello,

I'm looking for a way to control the values of an attribute using a
template.

Say i have the data in this form:

{
testArray: ["1", "2", "3"]
}

I'm looking to generate the following HTML:

<div id="1">
content: <span>1</span>
</div>
<div id="2">
content: <span>2</span>
</div>
<div id="3">
content: <span>3</span>
</div>


Is this possible with jstemplate? If so, how would a template look
like?

Thanks,
Alexis

Alexis Smirnov

unread,
May 22, 2008, 10:41:01 PM5/22/08
to google-jstemplate
Found my answer. Many thanks for good documentation!

The template to produce below HTML is:

<div id="t">

<div jsselect="testArray" jsvalues="id:$this">

content: <span jscontent="$this"></span>
</div>
</div>


jstemplate rocks

Reply all
Reply to author
Forward
0 new messages