js template实现方法
<script type="text/html" id="template"> <li class="list-item"><header class="item-header"> <span class="octicon octicon-file-text"></span> <span class="item-title">培训类型:入园-家长会</span> <span class="item-status reback">待回访</span> </header> <section class="item-content"> <span class="avator"><img alt="" src="/resources/img/training_plan/t1.png"></span> <span class="name">新加的</span> <ul class="content-items"> <li class="content-item">南京小树苗培训中心</li> <li class="content-item">江苏省-南京市</li> <li class="content-item">培训时长:<span class="red">120分钟</span></li> </ul> </section> <footer class="item-footer"> <span class="date">培训日期:2016-06-10 </span> <a href="javascript:;" class="detail">查看详情</a> </footer></li> </script>
var html = template("template"); $('.list-items').append(html); // 追加元素