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 :: get user location without permission 
Javascript :: javascript regular expression for alphanumeric 
Javascript :: js number to hex 
Javascript :: mouse coordinates not match with canvas coordinate 
Javascript :: javascript search on docuemt for text on iframe 
Javascript :: collision circle 
Javascript :: javascript localStorage clear items 
Javascript :: logic for building calculator using JavaScript without using eval 
Javascript :: javascript get text between two words 
Javascript :: nodejs sharp get image size 
Javascript :: react allow only numbers in input 
Javascript :: preview image file upload javascript 
Javascript :: sort date according to months in javascript 
Javascript :: how to call await outside async function in js 
Javascript :: javascript sort in array of objects 
Javascript :: how to run angular 
Javascript :: drupal twig node alias 
Javascript :: let count = 0;console.log(parseInt("count"+ 1)); 
Javascript :: how to find angle between two points 
Javascript :: get buffer from jimp js 
Javascript :: check device type in javascript 
Javascript :: javascript repeat element in array 
Javascript :: jquery check input 
Javascript :: remove empty or whitespace strings from array javascript 
Javascript :: useeffect umnount 
Javascript :: npm run test:coverage command in jest 
Javascript :: javascript substring last character 
Javascript :: how to make a screen recording software with js 
Javascript :: enable native bracket matching vs cide 
Javascript :: get rid of header bar react native 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =