I'd like to set vendor styles with Javascript, something like this:
elem.style.mozBorderRadius = '5px';
Is this possible? If so, how?
I'd like to set vendor styles with Javascript, something like this:
elem.style.mozBorderRadius = '5px';
Is this possible? If so, how?
You can check for and set it like this:
if (elem.style.MozBorderRadius !== undefined)
elem.style.MozBorderRadius = "5px";
You can do this for webkit as well while you're at it as well using webkitBorderRadius
, like this:
if (elem.style.MozBorderRadius !== undefined)
elem.style.MozBorderRadius = "5px";
else if (elem.style.webkitBorderRadius !== undefined)
elem.style.webkitBorderRadius = "5px";
Make sure to wrap it in an if()
like I have above, so it doesn't error in browsers that don't support it.