Installation page example just don't work

I tried use stimulus js without some build system and put it in my test.html file:

<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <script src="https://unpkg.com/stimulus/dist/stimulus.umd.js"></script>
  <script>
    (() => {
      const application = Stimulus.Application.start()

      application.register("hello", class extends Stimulus.Controller {
        static get targets() {
          return [ "name" ]
        }

        // …
      })
    })()
  </script>
<head>
<body>
  <div data-controller="hello">
    <input data-target="hello.name" type="text">
    …
  </div>
</body>
</html>

Nothing happened, nor an console error.
And i get this code here:

https://stimulusjs.org/handbook/installing#using-without-a-build-system

The example is just boilerplate code. It doesn’t actually do anything. Try adding an action to the controller :slight_smile:

1 Like

Now that you have the boilerplate in place, try starting here: https://stimulusjs.org/handbook/hello-stimulus#it-all-starts-with-html

3 Likes