Edit in GitHubLog an issue

HTML events and event listeners

There are different techniques to capture an HTML event and add eventlisteners to an element.

The technique you choose is simply your preference. Pick the method you feel most comfortable with. However, you need to configure one particular permission for inline event handlers, such as <button onclick="btnClick()">Click Me</button>

System requirements

Please make sure your local environment uses the following application versions before proceeding.

  • InDesign v18.5 or higher
  • UDT v1.9.0 or higher
  • Manifest version v5 or higher

Examples

Declaring event listeners in JavaScript

Copied to your clipboard
<button id="firstButton">Click me</button>
<button id="secondButton">Click me</button>

Declaring inline event handlers

Copied to your clipboard
<button id="thirdButton" onclick='foo(event)'>Click me</button>

Additional notes

  • The above examples will also work for Spectrum Widgets and Spectrum Web Components in UXP.

Reference material

  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.