开发者

How to bind object as a json string to another html element on JQUERY Template plugin

Actually i tried to find it but i was lost in plug-in lines while debugging. I want to show ho开发者_开发知识库w it is working because there are different template plug-ins.

$("#teplateScript").tmpl(arrOfWhatWeWantToBind).appendTo("#divElementwhichWillContainTheOutput");

I want to serialize every element of array(to json of course) with JSON.stringify and set the hidden element in the template. If i serialize object and add the output to the same object with another property, i could access it but i want to do this in the template like:

<script type="text/html">
   <div>$(propOfElement)</div>
   <input type="hidden" id="hdnObj_${idOfElement)" value="JSON.stringif( ?.....? )" />
</script>

What should i write to instead of ?....? place ?


<script type="text/html">
   <div>$(propOfElement)</div>
   <input type="hidden" id="hdnObj_${idOfElement)" value="${ JSON.stringify($data) }" />
</script>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜