1

I want to carry out two different functions based on the height of a div. How would I write out a conditional that checks the style before deciding?

2 Answers 2

4

You have:

var e = $("someSelectorThatGetsTheElement");
if (e.height() < 50) {
    // do something;
} else {
    // do something else;
}

EDIT: I made a small mistake, e.height is actually a function, so need to add the "()".

Sign up to request clarification or add additional context in comments.

Comments

0

You can use the height() method. The css(name) method can be used to return any style property.

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.