3

I have a div

div id='srch'

that has a computed height of 7000px how do i set the height of the another div to the same on window.load

div id='set_me'

2 Answers 2

7
document.getElementById('set_me').style.height = 
    document.getElementById('srch').offsetHeight + 'px';
Sign up to request clarification or add additional context in comments.

1 Comment

+1 Same answer as Spooks, but you took the time to add 4 spacebars
3
document.getElementById('set_me').style.height = document.getElementById('srch').offsetHeight +'px';

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.