YouTip LogoYouTip

Event Preventdefault

# jQuery event.preventDefault() Method ## Description The preventDefault() method prevents an element from performing its default behavior (for example, when a link is clicked, the browser will load a new page; when a submit button is clicked, the form will be submitted).
$(selector).preventDefault()
## Parameters | Parameter | Description | |:---:|:---| | event | Required. Specifies which event to prevent. This parameter comes from the event binding function | ## Usage Examples ### Example 1 The following example demonstrates how to prevent a link from opening a URL:
$("a").click(function(event){
  event.preventDefault();
});
### Example 2 Prevent form submission:
$("form").submit(function(event){
  event.preventDefault();
});
## Related Pages jQuery Events: [ ## More Examples (#) (#) ---

Copyright belongs to , all rights reserved!

Updating...

← Jq Event RelatedtargetEvent Pagey β†’