How to create equal height divs via jQuery

akbaralmansoor placeholder

Here is the code snippet to create equal height divs:

jQuery(document).ready(function(){

var first_div_height = jQuery('.first-div').height();
var second_div_height = jQuery('.second-div').height();
if(first_div_height < second_div_height){

jQuery(".first-div").css({"height": jQuery(".second-div").height() });

}else{

jQuery(".second-div").css({"height": jQuery(".first-div").height() });

}

});

Leave a Reply