Skip to content Skip to sidebar Skip to footer

Javascript Style Property Is Empty

I need to calculate the width of an element's border. If I set it explicitly (via CSS), then I can access it in JavaScript by: element.style.borderWidth However, if only spec

Solution 1:

You can use the window.getComputedStyle for modern browsers

window.getComputedStyle(element).borderBottomWidth;

For IE pre-9 you will have to use an alternative

element.currentStyle.borderBottomWidth 

Post a Comment for "Javascript Style Property Is Empty"