How to write to the variable height of the element?

var el = document.getElementById("id").style.width 

    1 answer 1

    Using the offsetHeight and offsetWidth . Example:

     var el = document.getElementById("id").offsetHeight 
    • Only it is necessary to take into account that if the height for the element is not explicitly indicated (for example, in CSS), then in different browsers you will get completely different values. Test the code - Deonis