Skip to content

Instantly share code, notes, and snippets.

@malachi358
Created July 25, 2013 07:03
Show Gist options
  • Save malachi358/6077468 to your computer and use it in GitHub Desktop.
Save malachi358/6077468 to your computer and use it in GitHub Desktop.
Remove Inline Styles with Jquery Plugin.
(function($)
{
$.fn.removeStyle = function(style)
{
var search = new RegExp(style + '[^;]+;?', 'g');
return this.each(function()
{
$(this).attr('style', function(i, style)
{
return style.replace(search, '');
});
});
};
}(jQuery));
//-fallowing is the target element and style to be removed-//
$('#element').removeStyle('style');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment