Skip to content

Commit 914b8a5

Browse files
authored
Merge pull request #752 from michaeleliot/michaeleliot-patch-1
Specify stimulus targets must be child components
2 parents c765239 + 2a67ae8 commit 914b8a5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

docs/handbook/02_hello_stimulus.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ We'll finish the exercise by changing our action to say hello to whatever name w
133133

134134
In order to do that, first we need a reference to the input element inside our controller. Then we can read the `value` property to get its contents.
135135

136-
Stimulus lets us mark important elements as _targets_ so we can easily reference them in the controller through corresponding properties. Open `public/index.html` and add a `data-hello-target` attribute to the input element:
136+
Stimulus lets us mark important child elements as _targets_ so we can easily reference them in the controller through corresponding properties. Open `public/index.html` and add a `data-hello-target` attribute to the input element:
137137

138138
```html
139139
<div data-controller="hello">

docs/handbook/03_building_something_real.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ Now let's add one more PIN field. This time we'll use a Copy _link_ instead of a
145145
</div>
146146
```
147147

148-
Stimulus lets us use any kind of element we want as long as it has an appropriate `data-action` attribute.
148+
Stimulus lets us use any kind of element we want as long as it has an appropriate `data-action` attribute, and is a child of the controller component.
149149

150150
Note that in this case, clicking the link will also cause the browser to follow the link's `href`. We can cancel this default behavior by calling `event.preventDefault()` in the action:
151151

0 commit comments

Comments
 (0)