Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

button prevent default

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

    return (
	         <button onClick={handleClick}>
             	Button text
             </button>
             )
 
PREVIOUS NEXT
Tagged: #button #prevent #default
ADD COMMENT
Topic
Name
7+7 =