The Spirit Bear

Written by Gray Gilmore

I make websites for a living. I love CSS and building simple and modular stylesheets. Somewhere along the way I also turned into a Ruby developer. Life comes at you fast I guess. You can read my resume to learn about my journey so far.

You can find me as @graygilmore on several platforms:

Good ol' fashion email works, too:

You can subscribe to this blog via RSS: XML, JSON

Remove Specific Inline Style with jQuery

Recently in a project I needed to remove inline styles after an animation completed. It looked something like this:

  something: value
}, function () {

This was working great until I realized that I need to keep some of those styles and I was really only wiping them all out to remove a specific style. Thus began the hunt for the best solution to find how to remove a specific inline style using jQuery.

It turns out the answer was staring at me all along. I can use the exact same method I was using to remove the entire style attribute. The answer looks like this:


Simply by providing a blank value, the left style declaration is completely removed. No silly regex required!