Here is some basic jQuery that does what you want. First hide all <li> elements with class="blocked" Then add click handler to <a> elements with class="add" to locate the first hidden <li> within the Category and to remove class="blocked" and show the <li> Add similar click handler for remove <a> element.
$('.blocked').hide(); $('.add').click(function() { var Category = $(this).parent().parent(); $('li:hidden:first', Category).removeClass('blocked').show(); return false; }); $('.remove').click(function() { var Category = $(this).parent().parent(); $('li:visible:last', Category).addClass('blocked').hide(); return false; }); Hope that helps Paul