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

    Fire a Stimulus Controller Action on a Click Event

    javascriptJavaScript

    In our Stimulus App, we change the connect method to a greet action (this method name can be anything.

    We then wire that action up to our HTML button by adding data-action to it and passing the function that we want to fire, in this case, its click->example#greet.