Link to home
Start Free TrialLog in
Avatar of dextermorgan
dextermorgan

asked on

Make DIVs the same height

I have 2 divs - both with the same class that gives them a min-height. What i want to do is to use javascript/jquery to check the height of DIV B and change the min height in the class.
Avatar of ajitha75
ajitha75
Flag of India image

document.getElementById('divb').style.height = document.getElementById('diva').style.height;

divb, diva are id's of the div's

-Ajitha
Avatar of Gurvinder Pal Singh
if there is a class 'divclass' which has the min-height property, then following code will change a property of a class.

setClassStyle( 0, "divclass", "min-height", document.getElementById("divB").height);
function setClassStyle(s_s,classname,class_style,style_valu e)
{
	var style_sheet=document.styleSheets[s_s];
	for (var j=style_sheet.rules.length-1;j>=0;j--)
	{
		var sS=style_sheet.rules[j];
		var class_name=sS.selectorText.replace(/\./g,'');
		if(class_name==classname)
		{
			sS.style[class_style]=style_value;
			return 0;
		}
	}
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Gurvinder Pal Singh
Gurvinder Pal Singh
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial