The innerWidth is an inbuilt method in jQuery which is used to return the width of the first matched element.
Syntax:
$(selector).innerWidth()
Here selector is the selected element.
Parameters: It does not accept any parameters.
Return value: It returns the width of the selector.
jQuery code to show the working of innerWidth() method:
<!DOCTYPE html> <html> <head> <script </script> <script> <!--jQuery code to demonstrate innerWidth function --> // document ready $(document).ready(function() { // on clicking the paragraph $("p").click(function() { // innerWidth document.getElementById("demo").innerHTML = "innerWidth = " + $("div").innerWidth(); }); }); </script> </head> <body> <div style="height: 100px;width: 200px; background-color: blue"> </div> <p>Click here to know innerWidth</p> <p id="demo"></p> </body> </html> |
chevron_right
filter_none
Output:
Before clicking on the paragraph-

After clicking on the paragraph-

Recommended Posts:
- JavaScript | Window innerWidth and innerHeight Properties
- jQuery | jQuery.fx.interval Property with example
- jQuery | jQuery.fx.off Property
- jQuery | jQuery.support Property
- jQuery | jquery Property
- jQuery | add() method with Example
- jQuery | event.timeStamp property with Example
- jQuery | focusout() with Example
- jQuery | parentsUntil() with Example
- jQuery | event.relatedTarget Property with Example
- jQuery | event.target Property with Example
- jQuery | finish() with Example
- jQuery | offsetParent() with Example
- jQuery | animated Selector with Example
- jQuery | :has() Selector with example
- JQuery | Multiple ID selectors
- jQuery | :input Selector
- jQuery | prepend() with Examples
- jQuery | dblclick() with Examples
- jQuery | offset() with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



