I’m trying to use this script from Github at https://github.com/blueimp/jQuery-File-Upload
The script has js codes like
<script id="template-upload" type="text/html">
{% for (var i=0, files=o.files, l=files.length, file=files[0]; i<l; file=files[++i]) { %}
<tr class="template-upload fade">
<td class="preview"><span class="fade"></span></td>
<td class="name">{%=file.name%}</td>
<td class="size">{%=o.formatFileSize(file.size)%}</td>
{% if (file.error) { %}
<td class="error" colspan="2"><span class="label important">Error</span> {%=fileUploadErrors[file.error] || file.error%}</td>
{% } else if (o.files.valid && !i) { %}
<td class="progress"><div class="progressbar"><div style="width:0%;"></div></div></td>
<td class="start">{% if (!o.options.autoUpload) { %}<button class="btn primary">Start</button>{% } %}</td>
{% } else { %}
<td colspan="2"></td>
{% } %}
<td class="cancel">{% if (!i) { %}<button class="btn info">Cancel</button>{% } %}</td>
</tr>
{% } %}
</script>
- Here, what does
{%or%}mean? - Why does the script tag has got an
id? What is its use, I’ve never
seen it anywhere before? - What does script
type="text/html"mean? I usually have been using
type="text/javascript"all the while.
Nothing, you’re not writing javascript, you’re just writing something that looks a lot like javascript.
Notice the line
If you were writing javascript the type would be
text/javascript(or in html5 you can just omit the type as that is assumed).So in answer to your three questions:
{% ... %}as if it were javascript.”<div>and<input>elements are.