Window.location not jump problem resolution

  • 2020-03-30 02:41:09
  • OfStack

Today, I ran into a problem when I wrote the code: in HTML, I used the onclick event to jump to window.location = url, and added href="javascrit:;" on the embedded elements. Properties. At this point the jump to window.location fails. Later, I looked it up on the Internet and remembered that the events in the javascript were bubbling and passing, which might have been organized by the embedded href event.

The solution is to add a return false statement to the onclick method to force the program to jump out of the following statement.

Related articles: