Defining a class with specific style dynamically in jQuery

Posted by Acorn on Stack Overflow See other posts from Stack Overflow or by Acorn
Published on 2010-04-25T12:44:11Z Indexed on 2010/04/25 12:53 UTC
Read the original article Hit count: 236

Filed under:
|
|
|

Is it possible to define a class with specific style attributes dynamically with jQuery, rather than setting the style of all elements with that class?

I could set the attributes of the class at the end of the script once all the elements have been created, but is that the best way to go about it? If I define the style of the class with $('.class').css('property','value'); at the beginning of the script, nothing would happen because the elements with class .class haven't been created yet, right?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery