I have an HTML element, but I did not specify the width or height (or sometimes I might not have defined the right or bottom, but I determined the width and height) in CSS.
Do you know how I can use JavaScript to get either the width or height of an element, either to the right or bottom, if I haven't set it?
#blockMenu { z-index: 0; padding: 10%; }
If I do the following, I know that this will not work, because I have not set the width or right:
var width = document.getElementById("blockMenu").offsetRight - document.getElementById("blockMenu").offsetLeft;
Is there a way to determine the size and position of an element if I have not installed it?
If not, if I determine the width; how to get width of elements using javascript?
source share