i want to set equal height in div which have class name “modelCode” so i made a small function to do so but when i am running this function it is setting height 0px in elemeny style. Before that i used .height() method which is working perfactly but i want to this with css height method any guess. Thanks in advance
<head>
<script type="text/javascript">
function equalHeight(group) {
var tallest = 0;
group.each(function () {
var thisHeight = $(this).css('height');
if (thisHeight > tallest) {
tallest = thisHeight;
}
});
group.css('height',tallest);
}
function setequalheight() {
equalHeight($(".modelCode"));
}
$(document).ready(function () { setequalheight() });
</script>
<style>
.modelCode { width:200px; float:left; border:solid 1px #F00}
</style>
</head>
<body>
<div class="modelCode">i am new text </div>
<div class="modelCode">i am new text <br />i am new text <br />i am new text <br />i am new text <br /></div>
it will work now
the problem is that .css(‘height’) returns a string value, so you have to parse it to integer to compare which is bigger value