ScalaJS Tutorial Step 4 Problem

Dear all,

I am following the ScalaJS tutorial:

I don’t get the specified output at Step 4. That is, clicking the button doesn’t add the specified paragraph. For the reference, I am including the relevant HTML at the P.S. here. (I am using ~fastOptJS so SBT automatically builds the project upon update.) Anyone knows what’s going wrong?

TIA,
–Hossein

P.S.

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>The Scala.js Tutorial</title>
  </head>
  <body>
    <!-- Include Scala.js compiled code -->
    <button id="click-me-button" type="button" onclick="addClickedMessage">
      Click me!
    </button>
    <script type="text/javascript" src="./target/scala-2.11/scala-js-tutorial-fastopt.js"></script>
  </body>
</html>

Could it be that you need to add parentheses here: onclick="addClickedMessage()"?

Truly so. Well spotted. :slight_smile: