微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

jsRepeater

程序名称:jsRepeater

授权协议: 未知

操作系统: 未知

开发语言:

jsRepeater 介绍

HTML Templating with minimal javascript

$('#myDiv').fillTemplate(myData)

The jsRepeater makes it easy to fill HTML Templates with javascript objects
e.g. data received from the server via AJAX

<script> var myData = {"Name" : "Google", "Type" : "Search Engine", "URL" : "www.google.com"}; $('#template1').fillTemplate(myData); </script> <body> <div id='template1'>${Name} is a ${Type} found at <a href='${URL}'>${URL}</a></div> </body>

results in:
Google is a Search Engine found at www.google.com

This is the most basic example. The power of jsRepeater lies in the fact that
it has support for some of the more complex functionality we need in the real
world e.g.

  • Binding not only to an object but child objects in one template
  • Ability to write your own javascript functions for output formatting
  • Access to numbering in a loop
  • No need for alternating templates, alternation handled in markup, not only even and odd values but also first and last
  • Infinite recursion down an object graph in one template

jsRepeater 官网

http://plugins.jquery.com/project/jsrepeater

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐