Reputation: 988
I want to pass -webkit-background-clip property with javascript.
Because of the hyphen at start, I cant seem to get it right. Tried it with [, ", ' etc. How do I escape dash?
document.getElementById("menu").style.-webkit-background-clip = "text";
Upvotes: 0
Views: 1633
Reputation: 490263
You can use bracket notation...
document.getElementById("menu").style["-webkit-background-clip"]
...or use camel case...
document.getElementById("menu").style.webkitBackgroundClip
Note that JavaScript resolves these to different names, but the browser supports both.
Upvotes: 3
Reputation: 6937
try
document.getElementById("menu").style["-webkit-background-clip"] = "text";
Upvotes: 1