Home  >  Article  >  Web Front-end  >  Usage explanation of event.preventDefault() function in js

Usage explanation of event.preventDefault() function in js

巴扎黑
巴扎黑Original
2017-07-22 15:20:072603browse

1. First, event.preventDefault() notifies the browser not to perform the default action associated with the event, for example:

The default event of the a tag here is jump , here we tell the browser to cancel the default event, so that the jump function of the a tag will not work. On the contrary, the a standard restore default event function is as follows:

The above is the detailed content of Usage explanation of event.preventDefault() function in js. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn