So I want to get the css from a particular Element, put it in JSON-array, change element around, later restore the css of the element from the stored Array.
I tried:
var currentCSS = $(this).css;
The output is something like:
function (a,c) if(arguments.length....
So that seems it takes the function out of the jQuery, that's not what I want...
I could iterate through the wanted individual arguments, but there should be a better way...
Then later offcourse I'd try something like:
$(this).css(currentCSS);
But there might be no elegant solution to doing this...
If all you are after is inline style as opposed to all of the style properties:
var $el=$(elem)
var style=$el.attr('style');
$el.removeAttr('style');
/* put style back*/
$el.attr('style',style);
Similarly after you have manipulated it, removing any inline adjustments that your code makes ... removing style attribute should put it back to whatever original css was applied
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With