Latest web development tutorials

jQuery innerWidth () method

jQuery HTML / CSS Methods jQuery HTML / CSS Methods

Examples

Back inside width of <div> element:

$("button").click(function(){
alert($("div").innerWidth());
});

try it"

Definition and Usage

innerWidth () method returns the first matching element of internal width.

As shown in the following image, the method comprising padding, but not border and margin.

jQuery Dimensions


Related methods:

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

grammar

$(selector).innerWidth()


Examples

More examples

Display size by related methods
How to use the width (), height (), innerHeight (), innerWidth (), outerWidth () and outerHeight ().


jQuery HTML / CSS Methods jQuery HTML / CSS Methods