This is my script
var str1 = "#";
var str2 = unique;
var n = str1.concat(str2);
if (status > 0){
$(n).attr("src", "/img/red.jpg")
}else{
$(n).attr("src", "/img/green.jpg")
}
This is my html- inside a table - the unique code (quite long id?) is the same as us.key()
It did work when I used find()
within the <tr>
tag (Overly complex and prone to errors though) This is simple and should work but isn't? Any ideas what I am doing wrong?
<td>
{% if us.status == 0 %}
<img id={{us.key()}} src="/img/green.jpg"></img>
{% else %}
<img id="{{us.key()}}" src="/img/red.jpg"></img>
{% endif %}
</td>
UPDATE: If I add the string directly into the scrip it works - somehow the concatenated string is getting changed