<script type="text/template" id="treeTableTpl"> <tr id="{{row.id}}" pId="{{pid}}"> <td><a href="${ctx}/sys/area/form?id={{row.id}}">{{row.name}}</a></td> <td>{{row.code}}</td> <td>{{dict.type}}</td> <td>{{row.remarks}}</td> <shiro:hasPermission name="sys:area:edit"><td> <a href="${ctx}/sys/area/form?id={{row.id}}">修改</a> <a href="${ctx}/sys/area/delete?id={{row.id}}" onclick="return confirmx(‘要删除该区域及所有子区域项吗?‘, this.href)">删除</a> <a href="${ctx}/sys/area/form?parent.id={{row.id}}">添加下级区域</a> </td></shiro:hasPermission> </tr> </script>
给script标签设置type="text/template"属性,标签里的内容不会被执行,也不会显示在页面上,但是可以在另外一个script里面通过获取插入到页面上。这样可以把大段的html和js进行分离。
var number = 123; $(‘#d‘).append(‘<div class="t">‘+number+‘</div>‘)
Js script type="text/template"的使用简单说明
原文:https://www.cnblogs.com/isme-zjh/p/12018024.html