How Can I Include a Variable in an ID Value?

I have some code I would like to repeat in my design. So I have made it an SSI and I can include it in two different places.

But…

There are some items like forms and buttons and inputs which need a unique ID.

Can I define their ID to be something like this?

id="'this_name'+some_variable.value"

Or is there another way of achieving what I want?

Every attribute can become dynamic by adding dmx-bind: before it. Example

dmx-bind:id="'this_name' + some_variable.value"

I just did this in a project!

<input class="form-check-input" type="checkbox" dmx-bind:id="folder_{{id}}" name="folder_update[]" dmx-bind:value="id">

{{id}} is coming from my repeat.

Perfect, thank you @Teodor and @otavionestares! :slight_smile:

1 Like

This one comes up often. @Teodor is there a reason the id does not show up in dynamic attributes?