HTML Events and Listeners

Handle user interactions using event listeners in JavaScript or inline event handlers

UXP supports standard HTML events for handling user interactions like clicks, input changes, and keyboard actions. You can attach event listeners in JavaScript (recommended) or use inline event handlers in HTML (requires additional permissions).

Prerequisites

Before you begin, make sure your development environment uses the following versions:

  • Premiere v25.6 or higher
  • UDT v2.2 or higher
  • Manifest version v5 or higher

The recommended approach is to attach event listeners in JavaScript using addEventListener() or by assigning event handler properties.

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

Example: Inline Event Handlers

You can define event handlers directly in HTML attributes, but this requires enabling a special permission.

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

Common Event Types

UXP supports standard HTML events:

Event TypeFires WhenCommon Use Cases
click
Element is clicked
Buttons, links, interactive elements
input
Input value changes
Text fields, sliders, checkboxes
change
Input value changes and loses focus
Dropdowns, file inputs
submit
Form is submitted
Forms
keydown
Key is pressed
Keyboard shortcuts
keyup
Key is released
Text input validation
focus
Element receives focus
Input fields
blur
Element loses focus
Input validation

Working with Spectrum Components

Event listeners work the same way with Spectrum Web Components:

Copied to your clipboard
// Spectrum button
const button = document.querySelector("sp-button");
button.addEventListener("click", () => {
console.log("Spectrum button clicked");
});
// Spectrum slider
const slider = document.querySelector("sp-slider");
slider.addEventListener("input", (event) => {
console.log(`Slider value: ${event.target.value}`);
});

Reference Material

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