It doesn't work because browsers return a CSSStyleDeclaration object,
or something similar, you can try it with firebug: $('body')[0].style

But I have just released a "plugin" that enables you to solve this
very easily. I put some other stuff into it too that you probably
don't need but that can be easily removed. Here it is:
http://plugins.jquery.com/project/EnhancedAttributeSelectors

and this how it can be used:
$("div[~background-color=firebrick]");

The standard way would be to make a pseudo selector for this but
somehow I like this approach more. If you don't, then have a look at
the plugins page, I'm sure someone has made a lighter pseudo selector
for this.


On Jan 29, 8:47 pm, kevotheclone <kevothecl...@gmail.com> wrote:
> Thanks for the reply Shane!
>
> Yes looping through the parent is an option that I was hoping to
> avoid.  Rigth now my Timeline only displays 30 projects (each one
> composed of 2 <div> elements), but SIMILE Timeline generates many more
> <div> elements within the parent containing <div>; 380 to be exact.
> So I'll have to loop through 380 to find the a few <div> elements that
> have the appropriate background color.  Since I don't generate any of
> the Timeline elements I'm kind of at SIMILE mercy (and I don't wat to
> alter their code).  I guess performance wise me examining 380 <div>
> elements isn't any different than waht JQuery would have to do, but I
> was hoping for a nice elegant JQuery one liner.
>
> It does seem like $("div[style*= firebrick]"); should work.
>
> Find all <div> elements whose "style" attribute contains "firebrick".
>
> Can anyone explain the logic why this doesn't work?
> Is this a bug or a documented exception that I failed to find/read?
>
> Thanks again to Shane and the rest of the JQuery community!

Reply via email to