jQuery Intro

jQuery Intro Quiz

jQuery Intro Exercise

jQuery Basic

jQuery Basic Quiz

jQuery Basic Exercise

jQuery Advance

jQuery Advance Quiz

jQuery Advance Exercise

jQuery Selectors

jQuery Effects

jQuery Events

jQuery Methods and Properties

jQuery Traversing

jQuery CSS and HTML Methods

jQuery width() Method

jQuery width() Method



The width() method is used to set or return the width of the selected elements.


For your Information:-


  • When it is used to set width, it will set the width of ALL matched elements.
  • When it is used to return width, it will only return the width of the first matched element.


Some of its relative methods are height(), innerWidth(), innerHeight()outerWidth(), and outerHeight().




Its syntax is:- $(selector).width(value) OR $(selector).width(function(index,currentheight))


Further Explanation:-


Parameter Description
value Required for setting width.
function(index,currentwidth) Optional. Specifies a function that returns the new width of selected elements
  • index - Returns the index position of the element in the set
  • currentwidth - Returns the current width of the selected element

Code Explanation

All Tutorials related to jQuery CSS and HTML Methods

All Sections related to Jquery