Hi jQuery group,

The simple piece of code below is designed to highlight table cells
whose class name is that of the currently hovered one (to visually
group them). In my example the class name itself is film + id (film1,
film2, etc) so I use the [attribute^=value] selector. OK to that
point, but if the class attribute happens to have whitespace-separated
"extra content" for css purposes (eg class="film1 small" ), the
selector doesn't capture the element. More generally it seems to dodge
any attribute value ending with a white-space + another char. Any idea
why?

<code>
$(document).ready(function() {
  $("[class^='film']").bind("mouseover",function() {
        $
("."+this.attributes['class'].value).css({"cursor":"pointer","background-
color":"#FFCC99"});
  });
  $("[class^='film']").bind("mouseout",function() {
        $
("."+this.attributes['class'].value).css({"cursor":"pointer","background-
color":"transparent"});
  });
</code>

Thanks.

Reply via email to