- 1
What is the use of hiding an element using display: none property?
I mean, what are we going to do with an element that is invisible and doesn't occupy any space? In which context this display property will be useful?
2 Answers
+ 7
Yes it seems pretty useless if you view it from the CSS perspective ONLY.
But with Javascript, you can toggle the visibility based on certain criteria with your own logic.
For example, you can show the POST button while hiding EDIT and DELETE button for creating new post and toggle it for existing post. đ
+ 6
Its useful in many ways , like I used here :-
https://code.sololearn.com/WLVTZ0kY1t0f/?ref=app