T
T
timtimIT2015-09-19 18:36:03
JavaScript
timtimIT, 2015-09-19 18:36:03

Is there an error in the code?

Hello!
Tell me what's the problem.
There is a code

$(document).ready(function() {
  var max = 0,
  $address = $('.hotel_name');
  $address.each(function(){
    if($(this).height() > max){
    max = $(this).height();
    }
  });
  $address.each(function(){
    $(this).height(max);
  });

});

In theory, it sets the height of blocks with the class .hotel_name equal to the height of the block of this class with the largest height. But for some reason, all blocks have a height of 22px, regardless of the content (that is, in fact, if the height should be 60px , it is still set to 22px)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question