Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок+ 9
Hiding elements
How can I hide an element if the player clicks a certain button?
5 ответов
+ 8
Thanks a lot!
+ 5
From your question, two actions need to be carried out. The first being the user interaction and the second, hiding the element. User interaction is handled by events, either inlined or in a script.
button.addEventListener('click', hideElement, false);
function hideElement() {
element.style.display = 'none';
}
The display property determines if the element will show up on the page. This is not to be confused with the visibility property. The latter allows the element to still take up space but the former totally hides it.
Read on event listeners to grasp its concept and understand what arguments it can take.
+ 2
add on click listener to a button and write something like that in it:
document.getElementById("elementToHide").style.display = "none";
+ 2
learn jquery if u don't know js. (jquery belongs to js).
but easier to leaarn
- 1
l