You can catch the event and then block it with preventDefault () -- works with pure Javascript document.getElementById ("xyz").addEventListener ('click', function (event) { event.preventDefault (); console.log (this.getAttribute ("href")); /* Do some other things*/ }); Share Follow edited Feb 19, 2015 at 15:52 answered Feb 19, 2015 at 15:29 Toggling a checkbox is the default action of clicking on a checkbox. Why don't objects get brighter when I reflect their light back at them? Well start off with a pretty common UI pattern a file upload panel and see how each of them affect its behaviour. That's why v-on can also accept the name or path of a component method you'd like to call. and then signUp 's first parameter will be the event, and you'll be able to use it and call preventDefault on it as you're trying. Even after so many years, the question is still relevant. Does Chain Lightning deal damage to its original target first? Use the stopPropagation() method to Theorems in set theory that use computability theory tools, and vice versa. preventDefault () React React event , input, form submit event.preventDefault ();. While using W3Schools, you agree to have read and accepted our, Clicking on a "Submit" button, prevent it from submitting a form, Clicking on a link, prevent the link from following the URL. cancelable Calling preventDefault () during any stage of event flow cancels the event, meaning that any default action normally taken by the implementation as a result of the event will not occur. Click on the blue box, and voila! Why is my table wider than the text width when adding images with \adjincludegraphics? (method) HTMLElement.addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options? You are adding onSubmitin the wrong place. 4 Therefore, here is the compilation: I prefer the variant 2 with return false; if it has to go quickly. What sort of contractor retrofits kitchen exhaust ducts in the US? // `this` inside methods points to the current active instance, , // now we have access to the native event, , , , ,