Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

prevent onclick event javascript

// Using CSS (prefered)
#foo {
    pointer-events: none;
}

//Using JS
const clickable = true;

document.getElementById("foo").onclick = () => {
    if (clickable) {
        //...your code
    }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: filter array inside array of objects javascript 
Javascript :: toast 
Javascript :: setinterval vs settimeout 
Javascript :: User Input from Javascript Console 
Javascript :: Connect MSSQL With JavaScript 
Javascript :: datepicker react native 
Javascript :: lodash isempty 
Javascript :: react currency format method 
Javascript :: array from string js 
Javascript :: debounce function in javascript 
Javascript :: react useEffect prevent first time 
Javascript :: javascript datatypes 
Javascript :: add getter to object javascript 
Javascript :: javascript telegram bot 
Javascript :: array some 
Javascript :: cypress run specific test 
Javascript :: scroll bar disappears after closing modal 
Javascript :: Modify the function increment by adding default parameters so that it will add 1 to number if value is not specified. 
Javascript :: react 
Javascript :: regex not js 
Javascript :: how to remove console.log from react native app 
Javascript :: update query in mongoose 
Javascript :: elapsed time function() {math javascript 
Javascript :: javascript find and update element from array 
Javascript :: javascript download image 
Javascript :: http module nodejs 
Javascript :: javascript trim whitespace 
Javascript :: dull a background image in react native 
Javascript :: chart js x axis data bar 
Javascript :: route not getting refresh with different id in angular 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =