i am tring to get the width/height values of an element in dom tree (HTML page) and i am using below method:
var event = e || window.event;
var target = event.target || event.srcElement;
i am getting id and class information by using
var classinfo = target.attributes.getNamedItem("class").nodeValue;
var idinfo = target.attributes.getNamedItem("id").nodeValue;
element.offsetWidth, element.offsetHeight: overall size of the containing box in pixels
element.clientHeight, element.clientWidth: content dimensions
These are read only properties, and always return the current rendered values.
(You need to assign a style property in the element or in a stylesheet to set most elements onscreen height and width.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With