My HTML : <div id="bar" ></div>
My CSS :
#bar
{
border-left-width:150px;
}
My JS :
function getStyle(el,styleProp)
{
if(el.currentStyle)var y=el.currentStyle[styleProp];
else if(window.getComputedStyle)var y=document.defaultView.getComputedStyle(el,null).getPropertyValue(styleProp);
return y;
}
alert(getStyle(document.getElementById("bar"),"border-left-width"));//Outputs 0px
The fiddle : http://jsfiddle.net/4ABhZ/1
How can I get the border-left-width property? (with my exemple it’s not working (on firefox))
Check your
border-left-styleproperty. It’s set tonone(the default). Set it to something likesolidand you’re good to go: http://jsfiddle.net/Paulpro/4ABhZ/4/