Home > Web Front-end > JS Tutorial > body text

Discussion on the execution order of a tag click and href_javascript skills

WBOY
Release: 2016-05-16 16:43:15
Original
2172 people have browsed it

Premise: The project starts to bind the document click event, and an a tag of the document subclass is also bound to the click time. To achieve the effect, the document event does not trigger after the click event is triggered. That is, organizing event bubbling and adding methods to prevent event bubbling (e.stopPropagation(); e.preventDefault();) will not work. This only happens under Google now, and ff will not happen.
Reason: The href="#" of the hyperlink is triggered later than the click,
Solution: Add return false;

after the method
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template