Reputation: 10198
I have UL tag which contain Li with many classnames
,
I want to show
those Li whose classname are same
and hide others.
Here the JSFiddle DEMO
For example here If i click class1 then "John,Michle,Alex" will be visible rest all have to hide
EDITED: Also Sort Li while hiding list
ANSWER:
By changing $(this).show();
to
$(this).parent('Li').show();
solved my blank space problem :)
Upvotes: 2
Views: 1420
Reputation: 8937
.live()
, it's deprecated.each()
, it's unnecessary$("ul.tagingUL li").on("click", function () {
var className = $(this).attr('class');
$('#emplistName ul li span.'+className).show();
$('#emplistName ul li span:not(.'+className+')').hide();
});
Upvotes: 1