HTMLTextAreaElement: selectionchange event
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{APIRef("Selection API")}}
The **selectionchange** event of the Selection API is fired when the text selection within a {{HTMLElement("textarea")}} element is changed in either extent or direction, whether the selection is a caret or a range of characters.
For general information about this event, see [HTMLInputElement: selectionchange event](/en-US/docs/Web/API/HTMLInputElement/selectionchange_event).
Syntax
Use the event name in {{domxref("EventTarget/addEventListener", "addEventListener()")}}:
js-nolint
addEventListener("selectionchange", (event) => { })Alternatively, assign to the event handler property of the interface:
js-nolint
onselectionchange = (event) => { }Event type
A generic {{domxref("Event")}}.
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}