Last Updated: February 25, 2016
·
920
· rajeshkhatri13

Equall Column Height using script


$(document).ready(function () {
    setHeight('.col1, .col2, .col3');
});
var maxHeight = 0;
function setHeight(column) {
    //Get all the element with class = col
    column = $(column);
    //Loop all the column
    column.each(function () {
        //Store the highest value
        if ($(this).height() > maxHeight) {
            maxHeight = $(this).height();;
        }
    });
    //Set the height
    column.height(maxHeight);
}
</code>

<h2><a href="http://jsfiddle.net/rajeshkhatri13/APJ3e/" target="blank">http://jsfiddle.net/rajeshkhatri13/APJ3e/</a>

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside