Skip to content

Instantly share code, notes, and snippets.

@ccurtin
Last active August 29, 2015 14:24
Show Gist options
  • Select an option

  • Save ccurtin/376fc6a5bd56ece90807 to your computer and use it in GitHub Desktop.

Select an option

Save ccurtin/376fc6a5bd56ece90807 to your computer and use it in GitHub Desktop.
Javascript:jQuery: Remove Inline Styles
/// REMOVE STYLES plugin
// http://stackoverflow.com/questions/2465158/is-it-possible-to-remove-inline-styles-with-jquery
// USE: $('#element').removeStyle('display');
(function($) {
$.fn.removeStyle = function(style) {
var search = new RegExp(style + '[^;]+;?', 'g');
return this.each(function() {
if ($(this).attr("style")) {
$(this).attr('style', function(i, style) {
return style.replace(search, '');
});
}
});
};
}(jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment