simple demo of Handlebars.js & jquery.js

<html>
<head>
<script src="jquery-1.11.0.min.js"></script>
<script src="handlebars-v1.3.0.js"></script>
</head>
<script>
$(document).ready(function() {
var source = $("#entry-template").html();
var template = Handlebars.compile(source);
var context = {title: "My New Post", body: "This is my first post!"}
var html = template(context);
$("body").html(html);
})
</script>
<body> </body>
<script id="entry-template" type="text/x-handlebars-template">
<div class="entry">
<h1>{{title}}</h1>
<div class="body">
{{body}}
</div>
</div>
</script>
</html>

  

最新文章

  1. No Entity Framework provider found for the ADO.NET provider with invariant
  2. c++字符串
  3. 在JAVA中,关于反射机制的讨论
  4. Code First06---CodeFirst中的一对多关系
  5. Xcode6与Xcode5中沙盒的变动以及偏好设置目录的变动
  6. Unity手游之路&amp;lt;七&amp;gt;角色控制器
  7. Eclipse图标含义
  8. struts2表单提交的乱码的问题的解决
  9. Linux指令--ping
  10. 解析PHP程序员需要掌握的必备技能
  11. Django ORM中,如何使用Count来关联对象的子集数量
  12. 开源虚拟化KVM(一)搭建部署与概述
  13. a标签总结
  14. RedHat如何关闭防火墙&#160;:&#160;http://blog.csdn.net/chongxin1/article/details/76072758
  15. iOS---代理、协议、通知 详解
  16. Java 注解实例
  17. Pycharm 激活码(转) 有效期到2019/10月
  18. SQLyog客户端无法连接MySQL服务器
  19. 虚拟机安装Ubuntu的上网设置(有线网络和无线网络)
  20. 大数据学习之Scala中main函数的分析以及基本规则(2)

热门文章

  1. 编译webrtc for android库与apk
  2. eclipse spring4 ehache2.10 整合
  3. Fragment 懒加载
  4. php部分--题目:投票 重点:两个div套用,显示百分比;
  5. 【spring配置】——spring整合Quartz定时器
  6. 九度OJ 1164:旋转矩阵 (矩阵运算)
  7. mysql系列之5.mysql备份恢复
  8. BCH分叉是一次站队博弈
  9. WordPress升级出现Briefly unavailable for scheduled maintenance. Check back in a minute.
  10. LeetCode——Binary Tree Postorder Traversal