Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

onclick prevent default

function sayHello(e) {
   e.preventDefault();
   alert("hello");
}
---------------------
 <a href="#" onclick="sayHello(event);">Click to say Hello</a>
Comment

onclick prevent default

<a href="#" onclick="event.preventDefault(); myfunc({a:1, b:2});" />click</a>
Comment

button prevent default

const handleClick = (event: React.FormEvent<HTMLFormElement>) => {
        event.preventDefault()
        event.stopPropagation()
        console.log('Clicked')
    }

    return (
	         <button onClick={handleClick}>
             	Button text
             </button>
             )
Comment

PREVIOUS NEXT
Code Example
Javascript :: credit card regex javascript 
Javascript :: gitignore for angular 
Javascript :: how to check if input file is empty in jquery 
Javascript :: javascript remove from array by index 
Javascript :: free json hosting 
Javascript :: eslint disalbe check next line 
Javascript :: javascript sort array of objects by number 
Javascript :: text align-center js 
Javascript :: js string replaceall 
Javascript :: jquery on click get element 
Javascript :: phone number regex angular 
Javascript :: d3.js clear svg 
Javascript :: readonly javascript 
Javascript :: javascript detect click outside element 
Javascript :: react hide source code 
Javascript :: javascript add div before element 
Javascript :: Scrool to the bottom of a div 
Javascript :: javascript search in array of strings 
Javascript :: how to update node js version 
Javascript :: nuxt router go back 
Javascript :: javascript hex to binary 
Javascript :: get form response with javascript 
Javascript :: adding integers jquery 
Javascript :: js get transition duration 
Javascript :: vh not working on phone 
Javascript :: open page in new tab using jquery 
Javascript :: js object random key 
Javascript :: check given path is valid or not in nodejs 
Javascript :: nuxt 18 mountend route push 
Javascript :: how to check if localhost javascript 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =