Reputation: 4275
I have an html site consisting of many "cards", each card being a template and each card containing a list with an id tag.
Since the form IDs have to be unique I can not just name them with a hardcoded string but have to incorporate some card specific identifier.
I tried the following
<ul id= "tags"{{ object.id }}>
<li>Tag2</li>
</ul>
which I then try to refer to in a java script using
<script type="text/javascript">
$(function () {
$("#tags"{{ object.title }}).tagit({
...
});
});
</script>
But unfortunately this does not seam to work. Does anybody know how to mix strings and template variables in such a situation correctly?
Upvotes: 0
Views: 775
Reputation: 470
You need to place the template code inside the quotation marks.
<ul id="tags{{ object.id }}">
<li>Tag2</li>
</ul>
Upvotes: 4