Skip to main content

Use JavaScript (SAP KC)

This article will cover how to insert JavaScript within a page.

Insert JavaScript (JEM) Block

For the following example, we would like to add the JavaScript below to a MindTouch page:

function myFunction()
alert("Hello! I am an alert box!");



First, we'll select the JavaScript (JEM) block from the editor's styles drop-down:

You'll then be presented with a JavaScript (JEM) block within your page:

You can now place your cursor in the JavaScript block and add your code. Be sure to omit the <script> tags when adding your code in a JavaScript block:

After clicking Save, my JavaScript now successfully renders upon page load and presents my user with an alert box:

  • Was this article helpful?