I am trying to get a height of a (display: none) element but it returns 0. But when I am using jquery it returns a valid value using this code.
/* My Code */
const elm = document.querySelector('.elm');
console.log(elm.clientHeight);
//return 0
/* IN jQuery */
console.log($(elm).height());
//return 300
.elm{
height: 300px;
width: 300px;
background-color: #007bff;
display: none;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<div class="elm"></div>
I need it using javascript. We all knew it very well that, Everything is possible what jQuery does in pure javaScript. Advance Thanks.
[Note] I am new in javascript!