Thursday, August 8, 2013

Find Children of a Class or ID

To find the children of a a specific div or any class or ID in jQuery

trs = $('#jevents_body').find('table.day-list > tbody > tr');

Joomla JEvents Category Filtering

(function ($){
 var ready = (function(){
  setUpCalModule();
 });


 // events calendar category checkbox filtering
 var setUpCalModule = (function(){
   var left, trs;
   left = $('.content-area-left').children('.moduletable');
   if (!left.length) return;

   trs = $('#jevents_body').find('table.day-list > tbody > tr');

   left.on('change','#jevent-mod-cat-checks', function(){
     var checks = $(this).find('input[type="checkbox"]'),
 checked = checks.filter(':checked'),
 notChecked = checks.not(checked);

     checked.each(function(){
      deleteCookieValue(this.value);
trs.filter('[data-cat="'+this.value+'"]').show();
     });

     notChecked.each(function(){
      setCookie(this.value);      
trs.filter('[data-cat="'+this.value+'"]').hide();
     });

   });
 });

 // get ready ... go!
 jQuery(document).ready(ready);

})(jQuery);

No comments:

Post a Comment