This is a really simple question, and I thought .each would work but I can’t seem to figure it out. I have two classes and for each of these classes I want to run code (the html is being looped out)… however it seems to be only working for the first occurrence of it, and I have no idea how to make this work for every occurrence of it.
var mheight = $('.messagetext, .smessagetext').height();
if (mheight > 64) {
var getthis = $('.messagetext, .smessagetext');
getthis.siblings('.mopacity').show();
getthis.parents(".messagecontent").siblings('.messagefooter').children('.mspmore, .mfpmore').show();
}
so when I have .click with .messagetext and smessagetext it works fine (as to be expected) yet if it’s not done on a click, and I just want to run this for every occurrence of this class, it doesn’t work… I’m aware this is jquery 101 but I can’t figure it out. Any help is appreciated, thank you.
The .height() method returns the height of the first item in the jquery object.
Change to this: