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 :: javascript add css class 
Javascript :: switch statement javascript 
Javascript :: how to set width 100 react native 
Javascript :: getcontext in javascript 
Javascript :: events node.js 
Javascript :: javascript return multiple values 
Javascript :: ajax post request 
Javascript :: Node.js (node 11.12.0) sample 
Javascript :: url enocde in javascript 
Javascript :: react native file pdf to base64 
Javascript :: vscode module path aliases 
Javascript :: javascript handle updation of copy object 
Javascript :: javascript Convert to Number Explicitly 
Javascript :: JavaScript Add Methods to a Constructor Function Using Prototype 
Javascript :: javascript Passing Parameter as Default Values 
Javascript :: fetch second parameters 
Javascript :: JavaScript Code Blocks 
Javascript :: ejs split string 
Javascript :: jquery v3.3.1 download 
Javascript :: fingerprint 
Javascript :: change origin phaser 
Javascript :: phaser rotate around x y point 
Javascript :: phaser stagger play 2 
Javascript :: remove text and keep div inside a div jquery 
Javascript :: string variable 
Javascript :: HSETNX in redis 
Javascript :: how to put multiple conditions in if statement node .js 
Javascript :: add line break in innerhtml 
Javascript :: queryselector j 
Javascript :: printing in javascript 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =