Friday, May 1, 2009

Dynamically change css for DOM element.

Using jQuery we can change css attribute dynamically.


(1)Find by class and set Css attribute.

$(".overlay").css({'display':'block','background-color':'red'});

(2)Find by class and Remove class.

$(".overlay").removeClass("overlay");

similar methods are addClass, toggleClass

using jQuery we can make javascript programming easier.

Thanks.