As this suggests, we can use Id to get offsetheight. Is there anyway it can be achieved by using a class name??
$("#btn2").click(function(){
var elmnt = document.getElementById("myId");
alert("Offset height : "+ elmnt.offsetHeight);
})
$("#btn1").click(function(){
var elmnt = document.getElementsByClassName("myClass");
alert("Offset height : "+ elmnt.offsetHeight);
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="myId" class="myClass">Lorem Ipsum!</div>
<button id="btn1">Ofset height using Class Name</button>
<button id="btn2">Ofset height using Id</button>
This is not a duplicate of this question, Because I want to know how to select OffsetHeight with class and the answer to this question clears that