davioooh
davioooh

Reputation: 24666

How to get width value set in css using jQuery

After several attempts using width(), outerWidth() and css("width) I discovered that all of these methods return a calculated value (in my case always different from the original value), so how can I read the value I set for element width in my css?

Upvotes: 1

Views: 207

Answers (1)

Suresh Atta
Suresh Atta

Reputation: 121998

Try OuterWidth

$('#target').outerWidth(true);

the padding and border are included in the calculation; if you pass true, the margin is also included.

Upvotes: 1

Related Questions