JavaScript in an HTML Block




You can add JavaScript inside an HTML Block

The HTML Block is the WebView component from the respective SDK.


You add JavaScript as you would do in any standard HTML document.


The Tutorial app 'Simple JavaScript' implements a simple 
Click here to install the Simple JavaScript Tutorial app in your workspace.



JS Code

This is the code from the Simple JavaScript App Tutorial.

That code is in the HTML Block of your Tutorial App.


<!DOCTYPE html>

<html>

<head>
<script>
function myFunction() {
    document.getElementById("demo").innerHTML = "Paragraph changed.";
 }

</script>
</head>

<body>

<h1>My Web Page</h1>

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

<button type="button" onclick="myFunction()">Try it</button>

</body>
</html>


Learn More

Display a Web Page

- Use JavaScript to build a CheckBoxes UI

Exchange Variables between EachScape and your JavaScript code