Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamically set css filters via javascript

Tags:

javascript

css

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?

like image 471
seanlevan Avatar asked Feb 10 '13 21:02

seanlevan


1 Answers

As simple as:

document.getElementById("element").style.webkitFilter = "blur(1px)";
like image 128
VisioN Avatar answered Sep 30 '22 03:09

VisioN