Home  >  Article  >  Web Front-end  >  Discussion on the execution order of a tag click and href_javascript skills

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

WBOY
WBOYOriginal
2016-05-16 16:43:152176browse

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
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