I'm using jQuery FileUpload (by BlueImp). This plugins uses x-tmpl as templating. I want a tags input field to contain options filled by a PHP variable. I'm trying to make a prototype by just adding some dummy text.
Code:
<td id="{%=file.id||''%}" class="tagsInput" style="display:none;">
<select data-placeholder="Type 'C' to view" multiple class="chosen-select-no-results" tabindex="11">
<option value=""></option>
<option {% if(strpos(file.tags, "American Black Bear") !== FALSE) { echo 'selected'; } %{>American Black Bear</option>
<option {% if(strpos(file.tags , "Asiatic Black Bear") !== FALSE) { echo 'selected'; } %{>Asiatic Black Bear</option>
<option {% if(strpos( file.tags , "Brown Bear") !== FALSE) { echo 'selected'; } %{>Brown Bear</option>
<option>Giant Panda</option>
<option>Sloth Bear</option>
<option>Sun Bear</option>
<option>Polar Bear</option>
<option>Spectacled Bear</option>
</select>
</td>
However this code gives me:
VM34875:3 Uncaught SyntaxError: Invalid or unexpected token
This error is generated by tmpl.min.js
.
How can I check for previously selected options that are stored in file.tags
with x-tmpl
?