12

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

document.getElementById('id')
user199337
  • 8,063
  • 7
  • 23
  • 18

2 Answers2

29

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
  • 115,249
  • 25
  • 154
  • 140
26
var myElementStyle = document.getElementById('id').style;

myElementStyle.borderRadius = '1em'; // standard
myElementStyle.MozBorderRadius = '1em'; // Mozilla
myElementStyle.WebkitBorderRadius = '1em'; // WebKit
Eli Grey
  • 35,104
  • 14
  • 75
  • 93