vendredi 3 mars 2017

How can I append a number to end of id in a blaze #each template?

I have a checkbox form that is being rendered multiple times inside a blaze template and in order for each checkbox to work indiidally, it needs it's own unique id. How can I append a unique number to the end of the checkbox's id so that each checkbox behaves fine on it's own.

Here is the template

<template name='checkbox">
    <form>
        <p>
            <input type="checkbox" class="filled-in" id="filled-in-box" />
            <label for="filled-in-box"></label>
        </p>
    </form>
</template>

So if the template is rendered 5 times, there would be 5 id's and the fifth id would be "filled-in-box-5"




Aucun commentaire:

Enregistrer un commentaire