elepil
asked on
jQuery question about .css()
Is there a way for me to create something like this in jQuery during RUNTIME, i.e., ON THE FLY:
and then be able to reference the whole set of styles as .addClass(".someStyle")?
In other words, I don't want to have to do it this way: $("#someElement").css("col or", "yellow"), and so on.
Thanks.
.someStyle {
color: yellow;
background: red;
border: 1px solid blue;
}
and then be able to reference the whole set of styles as .addClass(".someStyle")?
In other words, I don't want to have to do it this way: $("#someElement").css("col
Thanks.
ASKER
Brian, thanks for responding, but I don't think you read my question carefully.
Notice I bold-faced RUNTIME and ON THE FLY.
I wanted to know if there was a way to still use addClass("someStyle") that somehow represents CSS styles created entirely within jQuery and not something defined in an external style sheet or within a <style> tag.
Notice I bold-faced RUNTIME and ON THE FLY.
I wanted to know if there was a way to still use addClass("someStyle") that somehow represents CSS styles created entirely within jQuery and not something defined in an external style sheet or within a <style> tag.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Exactly what I was looking for, thanks much, Brian!
Glad to help. Thanks for the points.
Please note when you use addClass the parameter is the class name and not a class selector (means no need for the dot)