How to set height in div using javascript

I have a div

div id='srch'

which has a calculated height of 7000px, how to set the height of another div to the same on window.load

div id='set_me'
+3
source share
2 answers
document.getElementById('set_me').style.height = 
    document.getElementById('srch').offsetHeight + 'px';
+7
source
document.getElementById('set_me').style.height = document.getElementById('srch').offsetHeight +'px';

if the possibility of srch height ever changes, it will always match

+3
source

Source: https://habr.com/ru/post/1765672/


All Articles