Description:

The jQuery outerWidth () method is used to GET/SET the outerย widthย for the matched element. This will includes left and right padding but not border/margin.

  • GET outerย Width: It will return the outerWidthย  for the selected/matched element
  • SET outerย Width: It will setย the outerWidthย  for the selected/matched element

Syntax

  • $(selector).outerWidth()
  • $(selector).outerWidth(value,function(Integer index, Number Width))
Margin It specify the Boolean value to include the element’s margin in the calculation.

  • False:It specifies noot to include the margin. It is a default value.
  • True:It specifies toย Include the margin.
Valueย  It specify the number of pixels or a number along with an optional unit.
function(Integer index,width A function returning the outer widthย to set. Get the index position of the element in the set and the old outer widthย asย parameter


If includeMargin set to false then the padding and border are included in the calculation; if true then the margin is also included.

Example:ย 

Output:ย 

Here, widthย of the box is 90. So width() method will return the same widthย mentioned the property but innerWidth() method will add the left(10px) , right(10px) padding ย and include border as well ( 5+5 = 10). S0 it return 120 as its outerWidth.

dotnet-helpers-jquery-outer-width-thiyagu