Skip to content

referring to element in x-for second time becoming undefined #1130

Answered by SimoTod
sqllyw asked this question in 1. Help
Discussion options

You must be logged in to vote

You can only have one root element inside your x-for template. I think the readme mentions it.

<div x-data>
    <template x-for="i in 10">
        <div>
            <span x-text="i" ></span>
            <span x-text="i" ></span>
        </div>
    </template>
</div>

        
      

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sqllyw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants