jQuery plugin to copy all styles (inline, inherited, etc) from one DOM element to another.
Latest commit 827cc86 Sep 21, 2014 @moagrius Merge pull request #5 from Hypercubed/feature/bower.json
Added bower.json
Failed to load latest commit information.
README.md Update README.md Jan 6, 2014
bower.json Added bower.json Sep 12, 2014
jquery.copycss.js Merge branch 'master' into fix-empty-selector May 21, 2014



Quick, simple jQuery extension to retrieve or copy all styles (with optional whitelist and blacklist) from an HTML element.

Tested in Chrome, FireFox, Safari, IE6-9. Thanks to Vincent (link unknown) who tested and provided a fix for Opera.


$('#some-element').copyCSS('#another-element');  // copy all styles
$('#some-element').copyCSS('#another-element', ['top', 'left']);  // copy just top and left
$('#some-element').copyCSS('#another-element', null, ['top', 'left']);  // copy everything except top and left

This method can be a resource hog. Try to use the whitelist parameter if possible.