I have a list, and I want to run a switch statement for whether or not the clicked element has a certain class - then hide all the others.
Here's what I have, but the switch statement doesn't pick up the variable set with the click.
<ul>
<li class="all"><a>Show all</a></li>
<li class="design"><a>Design</a></li>
<li class="dev"><a>Development</a></li>
<li class="ux"><a>UX</a></li>
<li class="print">Print</a></li>
</ul>
and:
$(function() {
$('a').click(function() {
var wrkType = $(this).parent().attr('class')
//alert(day) // alerts !
});
});
switch (wrkType)
{
case 'dev':
alert('yahmon!')
if (!$('li').hasClass('dev')) { $('li').fadeOut(300); }
break;
case 'all':
//All things on
break;
}
How can I achieve this?