[jQuery] Re: Changing Class using Jquery

2008-12-04 Thread Paul Mills

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



[jQuery] Re: Changing Class using Jquery

2008-12-04 Thread WebNot

Thanks Paul
It worked absolutely perfect.
once again thank you very very much.


On Dec 5, 3:05 am, Paul Mills [EMAIL PROTECTED] wrote:
 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