Get height of div with no height set in css

后端 未结 4 916
后悔当初
后悔当初 2020-11-28 01:58

Is there any way to get the height of an element if there is no CSS height rule set for the element I cannot use .height() jQuery method because it need a CSS r

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-28 02:11

    Can do this in jQuery. Try all options .height(), .innerHeight() or .outerHeight().

    $('document').ready(function() {
        $('#right_div').css({'height': $('#left_div').innerHeight()});
    });
    

    Example Screenshot

    enter image description here

    Hope this helps. Thanks!!

提交回复
热议问题