1

When I use outerWidth() in jQuery it gives me the full width of the block element which is usually the whole page width (if it is the only thing on that line). In the picture below the red line is the width that I get from outerWidth(). The blue line is the width I am trying to find. How do I find the width of the area the text is taking up in jQuery.

enter image description here

Johnston
  • 20,196
  • 18
  • 72
  • 121

1 Answers1

2

So you are doing this:

.outerWidth

$('element').outerWidth();

Get the current computed width for the first element in the set of matched elements, including padding and border.

outerWidth

.innerWidth

$('element').innerWidth();

Get the current computed inner width (including padding but not border) for the first element in the set of matched elements or set the inner width of every matched element.

innerWidth

.width

$('element').width();

Get the current computed width for the first element in the set of matched elements or set the width of every matched element.

width

Best regards ;)

Hope this will explain it to you ;)

Community
  • 1
  • 1
boska0712
  • 65
  • 7