How to get CSS height value (rather than calculated height) in jQuery

M.S

Assume that the height of an element is set to 'auto'. Trying to get the height in jQuery returns the calculated height. Is there a way to get the actual CSS value (auto) instead of the height in pixels?

$('#myDiv').height() // returns calculated height

See http://jsfiddle.net/7GrwJ/

Yogu

It is possible to retrieve the raw CSS value, see this fiddle for the result (tested in Firefox and Chromium)

I used this answer to get the raw css object, and this gist to emulate a required function that is only natively available to Webkit.

After that, accessing the property is easy:

css($('#myDiv')).height

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Using jQuery, how would I get a div to increase height slowly rather than instantly with button onClick?

From Dev

jquery accordion get height value

From Dev

How height is calculated without setting it

From Dev

How is table cell height calculated?

From Dev

How does 'line-height' in ems get calculated in this scenario?

From Dev

Pass variable into jQuery CSS value to calculate height

From Dev

How does width/height get calculated on position:absolute container with text in it and width:auto;height:auto?

From Dev

Getting jQuery that changes height to do so immediately rather than on a second run?

From Dev

How do I get this CSS/jQuery menu to open only on click, rather than hover?

From Dev

Jquery CSS height Toggle

From Dev

How to set max height and fixed width for UITextView and force ellipsis rather than scroll if overflow occurs?

From Dev

How to measure area height and width in pixels (rather than cm) in Photoshop CS6?

From Dev

How to get the entire width and height of a document (no jQuery)

From Dev

How to get image height width in jquery

From Dev

How to get the height of a div container through jQuery?

From Dev

How to get line height in percentage using jquery?

From Dev

jQuery - How to get height from child of class

From Dev

How to get the height of a div container through jQuery?

From Dev

How to get height in AngularJS like in JQuery?

From Dev

How to get line height in percentage using jquery?

From Dev

How to get image height width in jquery

From Dev

'Greater than' some value in height()

From Dev

$(element).height vs $(element).css('height',value);

From Dev

How is the height of this grid-container being calculated?

From Dev

Excel - How to get expression text rather than the value

From Dev

How to get a value from an <input> rather than a prompt?

From Java

How to get a height of a Widget?

From Java

How to get height of Keyboard?

From Dev

How to get height of topLayoutGuide?

Related Related

  1. 1

    Using jQuery, how would I get a div to increase height slowly rather than instantly with button onClick?

  2. 2

    jquery accordion get height value

  3. 3

    How height is calculated without setting it

  4. 4

    How is table cell height calculated?

  5. 5

    How does 'line-height' in ems get calculated in this scenario?

  6. 6

    Pass variable into jQuery CSS value to calculate height

  7. 7

    How does width/height get calculated on position:absolute container with text in it and width:auto;height:auto?

  8. 8

    Getting jQuery that changes height to do so immediately rather than on a second run?

  9. 9

    How do I get this CSS/jQuery menu to open only on click, rather than hover?

  10. 10

    Jquery CSS height Toggle

  11. 11

    How to set max height and fixed width for UITextView and force ellipsis rather than scroll if overflow occurs?

  12. 12

    How to measure area height and width in pixels (rather than cm) in Photoshop CS6?

  13. 13

    How to get the entire width and height of a document (no jQuery)

  14. 14

    How to get image height width in jquery

  15. 15

    How to get the height of a div container through jQuery?

  16. 16

    How to get line height in percentage using jquery?

  17. 17

    jQuery - How to get height from child of class

  18. 18

    How to get the height of a div container through jQuery?

  19. 19

    How to get height in AngularJS like in JQuery?

  20. 20

    How to get line height in percentage using jquery?

  21. 21

    How to get image height width in jquery

  22. 22

    'Greater than' some value in height()

  23. 23

    $(element).height vs $(element).css('height',value);

  24. 24

    How is the height of this grid-container being calculated?

  25. 25

    Excel - How to get expression text rather than the value

  26. 26

    How to get a value from an <input> rather than a prompt?

  27. 27

    How to get a height of a Widget?

  28. 28

    How to get height of Keyboard?

  29. 29

    How to get height of topLayoutGuide?

HotTag

Archive