HTML plugin on click button function

I am trying to get the button function work in the HTML javascript plugin. To show a simpel variable with js, the on render space can be used. Now I want to run a simple button, but this gives an Uncaught ReferenceError: htmlNode is not defined, same for document.

    <body>

<h1>My First JavaScript</h1>

<button type="button"
onclick="document.getElementById('demo').innerHTML = Date()">
Click me to display Date and Time.</button>

<p id="demo"></p>

</body>

The next code with the function in a script does also give an error, saying that myFunction is not defined. Moving the funtion to onRender still says that myFunction undefined. How should i solve this?

<h1>My First JavaScript</h1>

<button type="button"
onclick="htmlNode.getElementById('demo').innerHTML = Date()">
Click me to display Date and Time.</button>

<p id="demo"></p>

</body>

This topic was automatically closed after 365 days. New replies are no longer allowed.