Reputation: 173
I am trying to fetch a variable from an alpinejs format to put into placeholder of my input, the code is as follows:
<template x-for="(field, index) in fields" :key="index">
<input type="text" name="sort" placeholder="<want to put index here>" />
</template>
Is this possible?
Upvotes: 3
Views: 3927
Reputation: 938
Try this:
<template x-for="(field, index) in fields" :key="index">
<input type="text" name="sort" x-bind:placeholder="index" />
</template>
Upvotes: 4