Ignore Elements on Initialization: x-ignore
Learn to prevent AlpineJS from initializing an element using x-ignore.
We'll cover the following
The x-ignore
directive
As long as an element lives inside x-data
or x-init
, AlpineJS will crawl and initialize it. Sometimes, we may not want AlpineJS to crawl or initialize an element in our component. To ensure AlpineJS doesn’t initialize such an element, we can use the x-ignore
directive. That way, AlpineJS will ignore initializing it.
Get hands-on with 1200+ tech skills courses.