I'm trying to group related elements using class name. They, in turn, are all related as they are all using the same prefix for the class name. Example:
<ul>
<li class="category-fruit"></li>
<li class="category-grain"></li>
<li class="category-meat"></li>
<li class="category-fruit"></li>
<li class="category-meat"></li>
</ul>
Visually, I want a hover function on each that, when hovered, will apply the same visual effect to the other elements sharing the same class name.
While it's easy to select a particular LI with a particular class, how would I go about picking a particular class from the hovered LI?
So in pseudo code
$("li").hover(function(){
$(this).[get-the-class-beggining-with"category"]
})
I'm guessing this involves using the starts with selector ([attribute^=value])