Look Mom No jQuery !!! Getting All CSS Properties of a DOM Element in Pure JavaScript

» Posted by on Jul 11, 2012 in Blog | Comments Off

Getting and setting CSS properties is a simple task. We can make it in pure JavaScript:var color = domElem.style.color; // Get color
domElem.style.color=’blue’; // Set new colorUsing jQuery it can be done with the $ .css() method: var color = $ (domElem).css(‘color’); // Get color
$ (domElem).css(‘color’, ‘blue’); // Set new colorThe recent jQuery++ project claims to have a $ .styles()…
Web Builder Zone – Web design, PHP, RIA, css, html, usability & some Ajax