Javatpoint Logo
Javatpoint Logo

jQuery resize() method

The jQuery resize() method triggers a resize event when the size of the browser window changes. It binds the event handler to resize an event or trigger that event on an element. This method can be used to perform some required actions such as avoiding scrollbars when adjusting the elements of the page on window resize, and many more.

If the resize event triggers and the element's dimension changes, the content inside the elements also adjusts as well.


This method accepts an optional parameter function, which specifies the function to execute every time the resize event is triggered.

Now, let's see an example of using the jQuery resize() method.


In this example, we are using the resize() method. Here, we are using the optional parameter of the resize() method. When the user resizes the window, the updated width and height of the window will be displayed on the screen. It will also display how many times the user tried to resize the window.

When we change the height of the window, the updated height will change accordingly. Similarly, when we change the width of the window, the updated width will change accordingly.

Test it Now


After the successful execution of the above code, the output will be -

jQuery resize() method

When we try to resize the window, the output will be -

jQuery resize() method

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA