Open In App
Related Articles

jQuery innerWidth() Method

Improve Article
Save Article
Like Article

The innerWidth is an inbuilt method in jQuery that is used to return the width of the first matched element.



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:

Example: Here is an example of the above-explained method.


<!DOCTYPE html>
    <script src=
        //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();
    <h2 style="color: green;">
    <div style="height: 100px;width: 200px;
                background-color: blue">
        Click here to know innerWidth
    <p id="demo"></p>



Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 10 Jul, 2023
Like Article
Save Article
Similar Reads
Complete Tutorials