首页 > 代码库 > JsRender系列demo(1)-insert-data
JsRender系列demo(1)-insert-data
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title> <script type="text/javascript" src="http://www.mamicode.com/scripts/jquery.js"></script> <script type="text/javascript" src="http://www.mamicode.com/scripts/jquery-ui.js"></script> <script type="text/javascript" src="http://www.mamicode.com/scripts/jsrender.js"></script> <link href="http://www.mamicode.com/scripts/demos.css" rel="stylesheet" /> </head><body> <script type="text/x-jsrender" id="movieTemplate"> <div>{{:#index+1}}:<b>{{>name}}</b>出版日期:{{>releaseYear}}</div> </script> <div id="movieList"></div> <script type="text/javascript"> var movies = [ { name: "Cupid", releaseYear: "1998" }, { name: "陌上花开", releaseYear: "1999" }, { name: "Tina", releaseYear: "1976" } ]; // Render the template with the movies data and insert // the rendered HTML under the "movieList" element //$("#movieList").html( // $("#movieTemplate").render(movies) //); $("#movieList").html($("#movieTemplate").render(movies));</script></body></html>
JsRender系列demo(1)-insert-data
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。