PreventDefault
From Svg wiki
Contents |
[edit]
Description
The preventDefault method stops the UA's default action for this event, if that event is cancellable. In common usage, this can prevent the activation of the right-click context menu.
Warning: In many script implementations, this also seems to cancel the event bubbling, though it is not supposed to. That effect is only supposed to occur with the use of the stopPropagation method (which often also prevents the context menu from activating).
[edit]
Type
Method
[edit]
Parameters
None
[edit]
Methods
None
[edit]
Return Value
None
[edit]
Related Methods and Objects
[edit]
Examples
This example will prevent the context menu from activating, if triggered on click, mousedown, and mouseup events:
function StopMenu( evt )
{
// if this is a right-click...
if ( 2 == evt.button )
{
// ...stop the menu from activating
evt.preventDefault();
}
}
[edit]
Implementation Support
[edit]
