I had a couple of div's that show their CSS styles according to an imported css file. However, during Javascript manipulation using jQuery, a lot of styles are attached in the 'style' attribute of the div and the latter overrides the CSS defined in imported file.

I wanted to clear all those styles defined as an attribute. The easiest way is to simply use the '*' as a means to choose all defined styles and set them all to an empty value of ''. Example:

 $('#myElem').attr('style', ''); //Select all '*' css styles defined as an attribute of #myElem's and set them to an empty value

 I was about to write a for-loop when I thought about this nifty solution.

 

NOTE: In case you're wondering what Javascript notation is that; I am using jQuery library. A similar method should be available in other Javascript Frameworks like prototype.