30 lines
752 B
Markdown
30 lines
752 B
Markdown
# Alpine.js Documentation - Directives
|
|
|
|
Alpine directives are attributes that you can add to HTML elements to give them special behavior.
|
|
|
|
## [x-ignore](/directives/ignore)
|
|
|
|
By default, Alpine will crawl and initialize the entire DOM tree of an element containing `x-init` or `x-data`.
|
|
|
|
If for some reason, you don't want Alpine to touch a specific section of your HTML, you can prevent it from doing so using `x-ignore`.
|
|
|
|
```
|
|
<div x-data="{ label: 'From Alpine' }">
|
|
|
|
|
|
n<div x-ignore>
|
|
|
|
|
|
n<span x-text="label"></span>
|
|
|
|
|
|
n</div>
|
|
|
|
|
|
n</div>
|
|
```
|
|
|
|
In the above example, the `<span>` tag will not contain "From Alpine" because we told Alpine to ignore the contents of the `div` completely.
|
|
|
|
Code highlighting provided by [Torchlight](https://torchlight.dev/)
|