tags:

views:

1206

answers:

2

I wish to change the text-shadow attribute of elements with javascript. As far as I know jquery css does not work with text-shadow.

Does anyone have any suggestions for dynamically changing text-shadow.

Thanks!

A: 

There is always this this little script.

But I don't understand why this wouldn't work:

$('#bla').css('text-shadow','#6374AB 20px -12px 2px');

Edit: Well, I tried it, and indeed jQuery was not impressed with my attempts. But I did find another script.

Cheers!

varl
+2  A: 

Works for me (Chrome and FF, not IE).

Try using camelCase. When working with CSS properties in JavaScript, you have to remove the hyphen (for example, "background-image" would become "backgroundImage") and then set the properties.

So your code should read:

$('#bla').css('textShadow','#6374AB 20px -12px 2px');

BraedenP