0

One of the most basic examples in the simplest possible HTML file isn't working for me. I just copy/pasted the HTML in the docs. (I also checked the HTML in the docs site and it's the same) It's very hard to debug this.

docs: https://hyperscript.org/docs/#basics code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Content 0</title>
    <script src="https://unpkg.com/hyperscript.org@0.9.11"></script>
</head>
<body>
  <h1> Content 1 </h1>
  <button _="on click toggle .red on me">
      Click Me
  </button>
</body>
</html>

One of the most basic examples in the simplest possible HTML file isn't working for me. I just copy/pasted the HTML in the docs. (I also checked the HTML in the docs site and it's the same) It's very hard to debug this.

docs: https://hyperscript.org/docs/#basics code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Content 0</title>
    <script src="https://unpkg.com/hyperscript.org@0.9.11"></script>
</head>
<body>
  <h1> Content 1 </h1>
  <button _="on click toggle .red on me">
      Click Me
  </button>
</body>
</html>

1 Answers1

0

When you look in the html, the above example works just fine. It toggles the button class correctly.

If you want to see visual results, you need to additionally define the .red styling.

<style>
  .red {background-color: red}
</style>
mariodev
  • 13,928
  • 3
  • 49
  • 61