Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to disable a div in javascript

// This is the DIV you'd like to disable
// Use the CSS selector to pin dow nthe exact DIV
var div = document.querySelector('div');

// Choose either 1, 2 or 3
// (1) Sets the disabled attribute
div.setAttribute('disabled', true);

// (2) Makes the DIV half transparent
// And changes the cursor to a "not allowed" symbol
div.style.opacity = '0.5';
div.style.cursor = 'not-allowed';

// (3) Delete the DIV
div.remove();
Comment

javascript disable div

// This will disable just the div
document.getElementById("dcalc").disabled = true;

// or

// This will disable all the children of the div
var nodes = document.getElementById("dcalc").getElementsByTagName('*');
for(var i = 0; i < nodes.length; i++){
     nodes[i].disabled = true;
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: new Date().now 
Javascript :: javascript cancel scroll 
Javascript :: how to create node js server 
Javascript :: use this inside a foreach 
Javascript :: js hover event 
Javascript :: node get current user 
Javascript :: react usecallback 
Javascript :: jquery set multiple options selected 
Javascript :: Type writer in react 
Javascript :: await loop javascript 
Javascript :: Material-UI: A component is changing the default value state of an uncontrolled Select after being initialized. To suppress this warning opt to use a controlled Select. 
Javascript :: tooltip in chakra ui 
Javascript :: make angular to run on a different port 
Javascript :: count using sequelize.fn 
Javascript :: regular expression in elastic 
Javascript :: label in lwc 
Javascript :: shouldcomponentupdate 
Javascript :: link to website electron 
Javascript :: password validation with regular expression in javascript 
Javascript :: vuejs alerts 
Javascript :: map method in react 
Javascript :: Odoo Plain Javascript files 
Javascript :: configuration react-router-dom v6 
Javascript :: data types in javascript 
Javascript :: convert set to array javascript 
Javascript :: npm request 
Javascript :: eslint disable next line multiple rules 
Javascript :: react radio button checked not working 
Javascript :: Material-ui account tree icon 
Javascript :: react component will mount new method 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =