Skip to main content
onselectionchange event

Fires when the selection state of a document changes.


HTML Attribute <element onselectionchange = "handler(event)">
Event Property object.onselectionchange = handler;
attachEvent Method object.attachEvent("onselectionchange", handler)
addEventListener Method object.addEventListener("selectionchange", handler, useCapture)


Event information



Event handler parameters

pEvtObj [in]

Type: IHTMLEventObj

Standards information

There are no standards that apply here.


To invoke this event, do one of the following:

  • Cause the selection object's type property to change.
  • Return a range from a different location when using the IHTMLSelectionObject::createRange method of the selection object.
  • Move the insertion point in an editable region of the document using the mouse or keyboard.
  • Refresh the page when an editable region has focus.
  • Start or extend a text selection by dragging the mouse or using SHIFT+an arrow key.
  • Make a control selection in an editable region of the document.
  • Add or remove an element from a multiple selection by pressing SHIFT while clicking on the element.
  • Delete text or an element in an editable region of the document by using the BACKSPACE key, DELETE key, CTRL+X, or the Delete command.
  • Insert text or an element in an editable region of the document by using CTRL+V or the Paste command.

The pEvtObj parameter is required for the following interfaces:

See also

Modifying Documents in Edit Mode