Skip to content

Conversation

@MaximVanhove
Copy link
Contributor

The code example uses # in the getElementById function, which breaks the code

// Wrong
document.getElementById('#trigger')

// Right
document.getElementById('trigger')

Full code example

<div x-data="{ open: false }">
    <button id="trigger" @click="open = ! open">Toggle</button>

    <div x-show="open" x-anchor="document.getElementById('trigger')">
        Dropdown content
    </div>
</div>

@MaximVanhove MaximVanhove changed the title Bug in code example of documantation for x-anchor to an ID Bug in code example of documentation for x-anchor to an ID Dec 20, 2023
@calebporzio calebporzio merged commit e3738a3 into alpinejs:main Jan 5, 2024
@calebporzio
Copy link
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants