Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why won't .getPropertyValue() return a value for the "borderRadius" property?

Tags:

javascript

css

Here is the function:

function lastmenuborder() {
    var articleparent = document.getElementById('article').parentNode;
    var articlestyle = window.getComputedStyle(articleparent,null).getPropertyValue('borderRadius');
    alert (articlestyle);
}

I get no value, yet the css for the parent node is:

div#mainbody div.placeholder {
    border-radius: 3px;
}

What would I have to change to return "3px"? All help greatly appreciated; I am still a newb at JavaScript.

like image 672
WK_of_Angmar Avatar asked May 29 '12 16:05

WK_of_Angmar


1 Answers

For getPropertyValue(), you use hyphens instead of camelCase.

This works in Chrome...

.getPropertyValue('border-radius');

But Firefox seems to require specific corners using this syntax...

.getPropertyValue('border-top-left-radius');
like image 162
user1106925 Avatar answered Oct 30 '22 20:10

user1106925