HTMLElement: loseinterest event

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Non-standard: This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists.

The loseinterest event of the HTMLElement interface is fired on the target element of an interest invoker when interest is lost, allowing code to be run in response.

This event is normally cancelable, except when the user hits the Esc key to lose interest in all interest invokers contained in the document.

Syntax

Use the event name in methods like addEventListener(), or set an event handler property.

js
addEventListener("loseinterest", (event) => { })

onloseinterest = (event) => { }

Event type

An InterestEvent. Inherits from Event.

Examples

Basic interest invoker event usage

In this example, we use the interest and loseinterest events to report when interest is shown and lost on a <button> element that acts as an interest invoker. We do this by printing messages into the target <p> element's text content.

HTML

We set up the relationship between the <button> element interest invoker and its target <p> element by setting the value of the <button> element's interestfor attribute equal to the <p> element's id.

html
<button href="#" interestfor="mytarget">Interest invoker</button>
<p id="mytarget">No interest being shown currently.</p>

JavaScript

We get a reference to the <button> element and its target element via the interestForElement property.

js
const invoker = document.querySelector("[interestfor]");
const target = invoker.interestForElement;

We then set two event listeners on the target element, for the interest and loseinterest events.

  • When interest is shown, we update the target <p> element's text content to report the event and include the element that triggered it; in this example, that's the <button> element. Note how you can get a reference to the interest invoker via the event object's source property.
  • When interest is lost, we update the paragraph text to report that interest is no longer being shown.
js
target.addEventListener("interest", (e) => {
  target.textContent = `Interest being shown via the ${e.source.tagName} element.`;
});

target.addEventListener("loseinterest", () => {
  target.textContent = `Interest lost.`;
});

Result

The example renders like this:

Try showing and losing interest in the button (for example, by hovering or focusing it) to see how the <p> text changes.

Specifications

This feature does not appear to be defined in any specification.

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
loseinterest event
Experimental Non-standard
Chrome – Full support
Chrome 142 (Release date: 2025-10-28)
footnote Full support
Edge – Full support
Edge 142 (Release date: 2025-10-31)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 126 (Release date: 2026-01-08)
footnote Full support
Safari – No support
Safari
footnote No support
Chrome Android – Full support
Chrome Android 142 (Release date: 2025-10-28)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 93 (Release date: 2025-11-25)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – Full support
WebView Android 142 (Release date: 2025-10-28)
footnote Full support
WebView on iOS – No support
WebView on iOS
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.
Non-standard. Check cross-browser support before using.

See also