seanlevan
seanlevan

Reputation: 1415

Dynamically set css filters via javascript

I'd like to apply this filter:

-webkit-filter: blur();

dynamically via JavaScript.

I looked everywhere online, and I couldn't find almost anything.

I would like to set the property dynamically through JavaScript via the DOM.

document.getElementById("element").style

How would I go about this?

Upvotes: 21

Views: 26078

Answers (1)

VisioN
VisioN

Reputation: 145388

As simple as:

document.getElementById("element").style.webkitFilter = "blur(1px)";

Upvotes: 31

Related Questions