cancellableEvent.preventDefault: Difference between revisions
Jump to navigation
Jump to search
m (Mex moved page event.preventDefault to cancellableEvent.preventDefault) |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
{{ | {{ScriptItem2 | ||
| | |name = preventDefault | ||
|side = shared | |||
|type = method | |type = method | ||
|class = | |class = CancellableEvent | ||
| | |games = iii vc sa iv | ||
| | |desc = prevent the default action for the current event which is triggering | ||
|return = void | |||
|freturn = void | |||
|note = See also: [[event.isDefaultPrevented|event.isDefaultPrevented]] | |||
| | |||
|exampleJSCS = addEventHandler('onPedInflictDamage', function(event, ped, responsibleEntity, weapon, loss, pedPiece) | |exampleJSCS = addEventHandler('onPedInflictDamage', function(event, ped, responsibleEntity, weapon, loss, pedPiece) | ||
{ | { |
Latest revision as of 20:36, 19 November 2022
Method
Server and Client
Online and Offline
Available since Server 1.0.0, Client 1.0.0
void cancellableEvent.preventDefault(void)
The cancellableEvent.preventDefault method is used to prevent the default action for the current event which is triggering.
Parameters
void | This method doesn't take any parameters. |
Return
void | This method doesn't return a value. |
Types
Shared
CancellableEvent
Notes
- See also: event.isDefaultPrevented.
Examples
Example 1 - JavaScript - Client-Side:
addEventHandler('onPedInflictDamage', function(event, ped, responsibleEntity, weapon, loss, pedPiece)
{
// Prevent the ped from being damaged.
event.preventDefault();
});
Compatibility
There isn't any compatibility information for this method.
Related
Server Related
addEvent
addEventHandler
bindEventHandler
removeEventHandler
triggerEvent
triggerNetworkEvent
unbindEventHandler
Client Related
addEvent
addEventHandler
bindEventHandler
removeEventHandler
triggerEvent
triggerNetworkEvent
unbindEventHandler