Important note: As some scripts — particularly those utilising the jQuery library — can interfere with AEM's authoring functionality, scripts are disabled during authoring mode. To test your script, click on the magnifying glass in the Sidekick to enter Preview mode. Refresh the page using your browser's refresh button and the script will be run.
5. Click the magnifying glass beside the field that appears.
Typically, this small block of code would be called in the
<head> of an HTML page. In AEM, this is done using an HTML Component.
- If your initialization script has structural tags, such as
<div>tags, place the HTML Component where you want it to be in your layout.
2. Inside the HTML Component, add your initialization. It may look someting like this:
3. Surround your initialization with
<script> elements, which lets the browser know what kind of code it's receiving. If you have any structural tags, such as
<div> elements, make sure they are outside the
4. Click OK to save your changes to the HTML Component.