[jQuery] Re: style selector (noob question)

2008-11-26 Thread donb
I don't think there's anyway to directly reference what's in a style declaration, only indirectly through an html element (as you found). However, you could temporarily create an element, assign the class of interest to it, and work with that. Of course, you probably want to 'learn' what classes

[jQuery] Re: style selector (noob question)

2008-11-26 Thread ricardobeat
You could access the CSS rules via document.stylesheets[x].cssRules [x].style.color, for example, but cross-browser support is not very good: http://www.quirksmode.org/dom/w3c_css.html - ricardo On Nov 26, 10:40 pm, Craig [EMAIL PROTECTED] wrote: Hi, does anyone know if it's possible to

[jQuery] Re: style selector (noob question)

2008-11-26 Thread seasoup
I don't think jQuery is designed to get an attribute from a class. The code you wrote div class=myclass / ... var color = $(.myclass).css(background-color); works by pulling the background color from the DOM object. A different hack that would work in one line:

[jQuery] Re: style selector (noob question)

2008-11-26 Thread seasoup
ok, found a plugin for you: http://flesler.webs.com/jQuery.Rule/ On Nov 26, 4:40 pm, Craig [EMAIL PROTECTED] wrote: Hi, does anyone know if it's possible to extract a style attribute from a style (and not an element)? For instance: style .myclass { background-color:white; } /style I