get the width of an element inside an element javascript code example Example: javascript get width of a div document.getElementById("mydiv").offsetWidth