Onselect is not being triggered on a tag with an contenteditable attribute

Try yourself:
https://www.w3schools.com/code/tryit.asp?filename=FY3C64FZV7UL

A proof that it works on a input tag:
https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onselect

Am I doing something incorrectly?

Apparently in HTML5 the select event only works with input and textarea elements.
see: https://www.w3.org/TR/DOM-Level-3-Events/#event-type-select

1 Like

World Wide Web Consortium says

The select event might not be available for all elements in all languages. For example, in HTML5, select events can be dispatched only on form input and textarea elements. Implementations can dispatch select events in any context deemed appropriate, including text selections outside of form controls, or image or markup selections such as in SVG.