onbeforeeditfocus event

Fires before an object contained in an editable element enters a UI Activation state or when an editable container object is control selection.


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

Event information

Synchronous No
Bubbles Yes
Cancelable Yes

Event handler parameters

  • pEvtObj [in]
    Type: [IHTMLEventObj](aa703876(v=vs.85).md)

Standards information

There are no standards that apply here.


For the HTMLFrameSiteEvents2::onbeforeeditfocus event to fire, document elements must be in edit mode. One way to invoke edit mode is to set the IHTMLDocument2::designMode property to On.

The HTMLFrameSiteEvents2::onbeforeeditfocus event differs from the HTMLFrameSiteEvents2::onfocus event. The HTMLFrameSiteEvents2::onbeforeeditfocus event fires before an object enters a UI Activation state, whereas the HTMLFrameSiteEvents2::onfocus event fires when an object has focus.

Note This event also fires when an input or textArea object gets the focus in browse mode.

As of Microsoft Internet Explorer 5.5, Web authors can also set the IHTMLElement3::contentEditable attribute to true on the body element, and if necessary, to specific elements in the body, to invoke edit mode.

Moves the object into a UI Activation state.

To invoke this event, do one of the following:

  • Press the ENTER key or click an object when it has focus.
  • Double-click an object.

The pEvtObj parameter is required for the following interfaces: