Setting img id with story variable

Is there any way to set an image element id with a story variable? I tried:

<<set _n to 0>>\
<<for _n <4>>\
<<set _n++>>\
<<set $imgid to "id"+_n>>\
<img id=$imgid src="image.png">\
<</for>>\

But this is not working. What is the problem?

You’ll need to use the evaluation attribute directive. For example:

<<for _n to 1; _n < 4; _n++>>\
<img @id="'id' + _n" src="image.png">\
<</for>>\
1 Like

That did it. Thank you, I didn’t saw this in the documentation.