Jquery .addClass to parent-parent var with .each -


please take @ code below:

var firstcalenderd = $('div.pmu-instance:eq(0) div.pmu-days div.pmu-button:not(.pmu-not-in-month)').each(function() {    var parsingevents = $('.rko-calendar-event');     parsingevents.each(function() {          if(firstcalenderm == gmonth && currday == gday)       {          .addclass('eventday');       }      }); }); 

as can see, there 2 .each() loops , 1 in one. if conditions met in second 1 (child of first), want add class first one. how call parent var?

firstcalenderd.addclass('eventday') - not working.

try cache in variable,

var firstcalenderd = $('div.pmu-instance:eq(0) div.pmu-days div.pmu-button:not(.pmu-not-in-month)').each(function() {    var parsingevents = $('.rko-calendar-event');    var parentvar = $(this);     parsingevents.each(function() {          if(firstcalenderm == gmonth && currday == gday)       {           parentvar.addclass('eventday');       }      }); }); 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -