tags:

views:

600

answers:

3

How can I set the -moz-border-radius with pure JavaScript (no jQuery, no plugins etc)?

document.getElementById('id')
+4  A: 

Try:

document.getElementById('id').style.borderRadius = '1em'; // w3c
document.getElementById('id').style.MozBorderRadius = '1em'; // mozilla

But why not do it in a stylesheet?

Crescent Fresh
Okay, that works, thank you! How do I do that now for webkit?PS: I want to keep my css valid.
style.WebkitBorderRadius = '1em'; // WebKit(Elijah Grey say this).And don't you want to accept an answer?
NilColor
A: 

It looks like this question may help you.

ptrin
+3  A: 
var myElementStyle = document.getElementById('id').style;

myElementStyle.borderRadius = '1em'; // standard
myElementStyle.MozBorderRadius = '1em'; // Mozilla
myElementStyle.WebkitBorderRadius = '1em'; // WebKit
Eli Grey