Hackerss.com

hackerss
hackerss

Posted on

Javascript Show a div that is hidden using display option


//create a div
const div = document.createElement('div');

//add a class to the div
div.classList.add('hidden');

//add a text node to the div
div.appendChild(document.createTextNode('Hello World'));

//add the div to the body
document.body.appendChild(div);

//change the display property of the div to block
div.style.display = 'block';

/*Javascript
create code that Show a div that is hidden using display option with comments
*/

//create a div
const div = document.createElement('div');

//add a class to the div
div.classList.add('hidden');

//add a text node to the div
div.appendChild(document.createTextNode('Hello World'));

//add the div to the body
document.body.appendChild(div);

//change the display property of the div to block
div.style.display = 'block';
Enter fullscreen mode Exit fullscreen mode

Top comments (0)