How to set style -webkit-box-shadow: 0px 0px 11px #000
to an element via JavaScript?
Since I haven't yet seen a code example that works without jQuery, here's one:
document.getElementById("test").style.webkitBoxShadow = "0px 0px 11px #000";
Note that the javascript property is not the same as the CSS property. The javascript properties do not use a dash and use camelCase instead.
And, a working demo here: http://jsfiddle.net/jfriend00/4LT7u/
You can set it using the style
object:
element.style['-webkit-box-shadow'] = '0px 0px 11px #000';
Demo: jsfiddle.net/S2eLb/
To be clear, this method does not require the jQuery library.
Use CamelCase like this:
WebkitBoxShadow
Generally, a -<lowerCaseLetter>
translates to the corresponding uppercase letter in the JS API.
$('#elementname').css({
'-webkit-box-shadow':'0px 0px 11px #000'})
You can use the .css
$("divClass").css("-webkit-box-shadow","0px 0px 11px #000");
Links: http://api.jquery.com/css/