get height of a div and set the height of another div using it

后端 未结 5 1075
孤街浪徒
孤街浪徒 2021-01-14 08:20

I have two divs, neither have a height set in css, as I want to take whatever height they end up as and set the other div to be that height.

The javascript I have is

5条回答
  •  南方客
    南方客 (楼主)
    2021-01-14 08:27

    you can get height by this code:

    document.getElementById('YourElementID').clientHeight;
    

提交回复
热议问题