So what I'm doing is trying to make a certain class of objects all equal, but make it useful and simplistic enough be re-purposed throughout various documents.
Everything look valid and legit to me, but something is messing up.
function cardHeights(divGroup) { console.log("This is running"); divGroup.each(function (e) { var current = $(this), curTallest = 0; if (current.height() > curTallest) { curTallest = current.height(); console.log(curTallest); } divGroup.height(curTallest); }); } Then I use this to call the function to work.
$(document).ready(function () { cardHeights('.card'); $(window).on('resize', cardHeights('.card')); }); Here is a codepen where I got it to work, but I can't get it to work on an actual site. Which is weird to me. It gives an error that it is not a defined function.
TypeError: e.each is not a function
curTallestto zero upon each iteration. You may want to set this outside of youreachloop. Also, only reset thedivGroupheight ifcurrent.height() > curTallest.cardHeights()expects a jQuery object. You are passing it a string.var divGroupObject = $(divGroup). Either way.