How can you hide an HTML element using JavaScript by applying an external CSS class?
A). element.style.display = 'none';
B). Add an external CSS file to the HTML document and link it.
C). Use the classList property to add a class with hidden properties.
D). element.classList.add('hidden');
How can you hide an HTML element using JavaScript by modifying its display property in an external CSS file?
A). element.style.display = 'none';
B). Add an external CSS file to the HTML document and link it.
C). Use the classList property to add a class with hidden properties.
D). element.classList.add('hidden');
How can you hide an HTML element using JavaScript without affecting its space in the layout?
A). element.style.display = 'none';
B). element.visibility = 'hidden';
C). element.style.visibility = 'hidden';
D). element.style.display = 'hidden';
Which JavaScript method is commonly used to hide an HTML element by adding a CSS class with hidden properties?
A). element.style.visibility = 'hidden';
B). element.classList.add('hidden');
C). element.style.display = 'none';
D). element.classList.toggle('hidden');
What is the advantage of using the classList property to hide HTML elements compared to directly modifying CSS properties?
A). It allows for more granular control and better readability.
B). It provides better performance and faster execution.
C). It simplifies code structure and improves cross-browser compatibility.
D). It increases code complexity and maintenance.
How can you hide multiple HTML elements using JavaScript by adding a CSS class with hidden properties?
A). element.style.display = 'none';
B). element.classList.add('hidden');
C). element.style.visibility = 'hidden';
D). element.style.display = 'block';
How can you hide an HTML element using JavaScript by modifying its CSS class?
A). element.style.display = 'none';
B). Add an external CSS file to the HTML document and link it.
C). Use the classList property to add a class with hidden properties.
D). element.classList.add('hidden');
What happens to an HTML element when its display property is set to 'none' using JavaScript?
A). It is removed from the DOM.
B). It becomes invisible but still occupies space in the layout.
C). It becomes visible but disabled.
D). It becomes hidden but still interacts with the layout.
How can you hide an HTML element using JavaScript without directly modifying its style properties?
A). Use the setAttribute() method to set display: none;.
B). Use the setStyle() method to set visibility: hidden;.
C). Use the removeAttribute() method to remove the element from the DOM.
D). Use the toggle() method to toggle between visible and hidden states.
How can you hide an HTML element using JavaScript by modifying its inline style directly?
A). element.setAttribute('style', 'display: none;');
B). element.style.display = 'none';
C). element.style.visibility = 'hidden';
D). element.display = 'none';