js 元素Dom新建并插入页面createElement
纯js
var o = document.createElement('script'); o.type = 'text/template'; o.id = 'demo'; document.documentElement.childNodes[0].appendChild(o);
jquery
$("<script type='text/template'>").attr('id', id + '_template').appendTo("body").load(url, function (tpl) {
cb(tpl);
});

浙公网安备 33010602011771号