Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery innerWidth() method

jQuery innerWidth() method

jQuery HTML/CSS methods jQuery HTML/CSS methods

Example

Return

The inner width of the element:

$

(

"

button

"

)

.

click

(

function

(

)

{

alert

(

$

(

"

div

"

)

.

innerWidth

(

)

)

;

}

)

;

Try it »


Definition and Usage

The innerWidth() method returns the inner width of the first matched element.

As shown in the image below, this method includes padding but not border and margin.

jQuery Dimensions


Related methods:

  • width() - Sets or returns the width of an element
  • height() - Sets or returns the height of an element
  • innerHeight() - Returns the height of an element (including padding)
  • outerWidth() - Returns the width of an element (including padding and border)
  • outerHeight() - Returns the height of an element (including padding and border)

Syntax

$(

selector

).innerWidth()


More examples

Display dimensions with related methods
How to use width(), height(), innerHeight(), innerWidth(), outerWidth(), and outerHeight().


jQuery HTML/CSS methods jQuery HTML/CSS methods