【发布时间】:2011-11-05 01:00:34
【问题描述】:
我正在使用 jquery append() 、 html() 等构建网页表单,并且我必须将下面显示的脚本写入页面(由其他一些外部包含脚本调用我认为是 ID)
将此脚本写入页面或包含它以便外部调用脚本可以找到它的最佳方式是什么?
相关问题:
如果我使用 jquery html() 或类似方法,是否必须去掉所有空格?在将大块格式化的内容输出到页面时,我似乎总是遇到空格问题。谢谢
<script id="template-upload" type="text/x-jquery-tmpl">
<tr class="template-upload{{if error}} ui-state-error{{/if}}">
<td class="preview"></td>
<td class="name">${name}</td>
<td class="size">${sizef}</td>
{{if error}}
<td class="error" colspan="2">Error:
{{if error === 'maxFileSize'}}File is too big
{{else error === 'minFileSize'}}File is too small
{{else error === 'acceptFileTypes'}}Filetype not allowed
{{else error === 'maxNumberOfFiles'}}Max number of files exceeded
{{else}}${error}
{{/if}}
</td>
{{else}}
<td class="progress"><div></div></td>
<td class="start"><button>Start</button></td>
{{/if}}
<td class="cancel"><button>Cancel</button></td>
</tr>
</script>
【问题讨论】: