1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Focus in input field on page load with `x-init` in Alpine JS

    alpineAlpine.js

    In this lesson, we learn how the x-init directive in Alpine JS lets us run a JavaScript expression once the component has initiated.

    We see the nuances that allow us to trigger that code before Alpine performs initial DOM updates, or after these updates have been made.