Snippets of JS: How to get height & width an of Element with Vanilla JavaScript?

You don’t need jQuery for this! For getting the height of an Element with Vanilla JavaScript: <br /> var element = document.querySelector('.element');<br /> window.getComputedStyle(element).height;<br /> For getting the width of an Element with Vanilla JavaScript: <br /> var element = document.querySelector('.element');<br /> window.getComputedStyle(element).width;<br />
1 of 1