onbeforeeditfocus event | beforeeditfocus event
Occurs before an input:file, input:password, input:text or textarea element or an element in an editable region becomes a UI-activated.
To specify an editable region, set the contentEditable property of an element to 'true' or the designMode property of the document to 'on'.
The UI-activated state differs from the activated state.
For example, if you cancel the onbeforeeditfocus event on a input:text element, the element gets the focus but the caret will not be visible.
How to register:
In HTML:
In JavaScript:
<ELEMENT onbeforeeditfocus="handler"> |
In JavaScript:
object.onbeforeeditfocus = handler; | ||||||
object.attachEvent ("onbeforeeditfocus", handler); |
You can find the related objects in the Supported by objects section below.
The event object is accessible to all event handlers in all browsers.
The properties of the event object contain additional information about the current event.
To get further details about these properties and the possible event handler registration methods, please see the page for the event object.
For a complete list of events, see the page for Events in JavaScript. |
Basic information:
Bubbles | Yes |
Cancelable | Yes |
Event object | - |
Actions that invoke the onbeforeeditfocus event:
For input:file, input:password, input:text and textarea elements:
For an element in editable mode:
The order of events related to the onbeforeeditfocus event:
Action | Event order |
---|---|
Any action that invokes the onbeforeeditfocus event. |
|
Example HTML code 1:
This example illustrates the use of the onbeforeeditfocus event:
|
||||
<head> <script type="text/javascript"> function CancelUIActivation (event) { // prevent the propagation of the current event if (event.stopPropagation) { event.stopPropagation (); } else { event.cancelBubble = true; } // cancel the current event return false; } </script> </head> <body> Try to activate the second input field! <br /><br /> <input accesskey="1" value="ALT + 1" /> <input accesskey="2" value="ALT + 2" onbeforeeditfocus="return CancelUIActivation (event);" /> <input accesskey="3" value="ALT + 3" /> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
document
HTML elements:
a, abbr, acronym, address, applet, area, b, bdo, big, blockquote, body, button, center, cite, code, dd, del, dfn, dir, div, dl, dt, em, embed, fieldset, font, form, frameset, h1, h2, h3, h4, h5, h6, hr, html, i, iframe, input:button, input:checkbox, input:file, input:password, input:radio, input:reset, input:submit, input:text, ins, isindex, kbd, label, legend, li, listing, marquee, menu, nobr, noframes, object, ol, p, plaintext, pre, q, rt, ruby, s, samp, select, small, span, strike, strong, sub, sup, table, tbody, td, textarea, tfoot, th, thead, tr, tt, u, ul, var, xmp
Related pages:
External links:
User Contributed Comments