Symfony UX: Stimulus
Targets: Finding Elements
  Unlock this challenge
Login Register

Challenge 1 / 1

What would you have to change to this controller to be able to get an array of all the matched targets instead of just one?

export default class extends Controller {
    static targets = ['item'];

    connect() {
        this.itemTarget.forEach((itemElement) => {
            // Do something with this target
        });
    }
}
Skip challenges and go to theNext Chapter

Turn Challenges Off?

All further challenges will be skipped automatically.
You can re-enable challenges at any time on this page or from your account page.