也许有些人知道blueimp的jquery文件上传插件:https://github.com/blueimp/jQuery-File-Upload/。我有以下问题,我想隐藏已经上传的文件的一部分表,我不能这样做,当我在普通表上这样做时,我这样做:https://stackoverflow.com/a/215231/1353905。
但是当我试图将tbody标签添加到此表代码中时(我想隐藏行9,10,11 - 表包含11行):
<script id="template-download" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { alert(i); %}
{% if(i==8) { %}
<tbody style="display:none;"> // I'm ADDING THIS
{% } %}
<tr class="template-download fade">
{% if (file.error) { %}
<td></td>
<td class="name"><span>{%=file.name%}</span></td>
<td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
<td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
{% } else { %}
<td class="preview">{% if (file.thumbnail_url) { %}
<a href="{%=file.url%}" title="{%=file.name%}" rel="gallery" download="{%=file.name%}"><img src="{%=file.thumbnail_url%}"></a>
{% } %}</td>
<td class="name">
<a href="{%=file.url%}" title="{%=file.name%}" rel="{%=file.thumbnail_url&&'gallery'%}" download="{%=file.name%}">{%=file.name%}</a>
</td>
<td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
<td colspan="2"></td>
{% } %}
<td class="delete">
<button class="btn btn-danger" data-type="{%=file.delete_type%}" data-url="{%=file.delete_url%}">
<i class="icon-trash icon-white"></i>
<span>{%=locale.fileupload.destroy%}</span>
</button>
<input type="checkbox" name="delete" value="1">
</td>
</tr>
{% if(i==10) { %}
</tbody> // here are my 3 lines too
{% } %}
{% } %}
</script>