control-freak-ide/Control-Freak-Documentation/jQuery/docs/entries/event.preventDefault.json
plastic-hub-dev-node-saturn 538369cff7 latest
2021-05-12 18:35:18 +02:00

1 line
976 B
JSON

{"name":"event.preventDefault","type":"method","title":"event.preventDefault()","deprecated":null,"removed":null,"desc":"If this method is called, the default action of the event will not be triggered.","categories":["events/event-object","version/1.0"],"entries":[{"return":"undefined","signatures":{"added":"1.0"},"examples":{"desc":"Cancel the default action (navigation) of the click.","code":"\n$( \"a\" ).click(function( event ) {\n event.preventDefault();\n $( \"<div>\" )\n .append( \"default \" + event.type + \" prevented\" )\n .appendTo( \"#log\" );\n});\n","html":"\n<a href=\"http://jquery.com\">default click action is prevented</a>\n<div id=\"log\"></div>\n"},"longdesc":"\n <p>For example, clicked anchors will not take the browser to a new URL. We can use <a href=\"/event.isDefaultPrevented/\"><code>event.isDefaultPrevented()</code></a> to determine if this method has been called by an event handler that was triggered by this event.</p>\n "}]}