How to find the width of a div using vanilla JavaScript?
You can use clientWidth
or offsetWidth
Mozilla developer network reference
It would be like:
document.getElementById("yourDiv").clientWidth; // returns number, like 728
or with borders width :
document.getElementById("yourDiv").offsetWidth; // 728 + borders width
document.getElementById("mydiv").offsetWidth
- element.offsetWidth (MDC)