hotwired / stimulus

A modest JavaScript framework for the HTML you already have
https://stimulus.hotwired.dev/
MIT License
12.55k stars 420 forks source link

Set the same value to a target defined multiple times on the page #145

Closed eirvandelden closed 6 years ago

eirvandelden commented 6 years ago

What I did:

What I expected:

What I got:

On StimulusJS 1.0.1 (and a Rails 5.1 app)

skyksandr commented 6 years ago

I believe you have to use plural form this.solutionTargets and iterate over like:

this.solutionTargets.forEach( (elem) => { elem.value = 'foo' } )
javan commented 6 years ago

@skyksandr is correct (thanks!)