Q:

Set line-height of div through jQuery?

There are 2 divs: Div1 and Div2.
I have a function that determines Div1's height and sets Div2's height to match it if Div2's height is smaller.
I am trying to make that function also set Div2's lineheight equal to Div1's height if Div2's height is smaller.
This is very tricky to me.
My attempt:
$(document).ready(function() {

    function setDiv2Height(){

        var Div1Height = $('#Div1').height();
        var Div2Height = $('#Div2').height();

        if (Div2Height < Div1Height) {    
            $('#Div2').height($('#Div1').height()); 

            $('#Div2').css("line-height", ($('#Div1').height())));
        }

    }

});

A:

Remove the extra ) . and div { line-height: 1.2;} is same as setting div { line-height: 1.2em;}. So you might have to change number to number + 'px';

$(document).ready(function() {

    setTimeout(function setDiv2Height(){

        var Div1Height = $('#Div1').height();
        var Div2Height = $('#Div2').height();

        if (Div2Height < Div1Height) {    
            $('#Div2').height($('#Div1').height()); 

            $('#Div2').css("line-height", ($('#Div1').height()+"px"));
        }

    },2000);

});
#Div1{
    height:200px;
    border:1px solid black;
    width:100%;
}

#Div2{
    height:100px;
    width:100%;
    border:1px solid black;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="Div1">1qaz</div>
<div id="Div2">1qaz</div>

