Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • What is Jquery innerWidth() method ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 245
    Comment on it

    Hello Readers,

    innerWidth() is the jquery method and it is same as innerHeight() method in jquery but the difference is that it is used to get or computed the innerWidth of the jquery matched element, this method including padding of the element while computing innerWidth of the element as like innerHeight but not consider the border and margin of the element in jquery.

    Syntax :

    $(selector).innerWidth()
    

    Code Example :

    <html>
    <head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script>
    $(document).ready(function(){
        $("button").click(function(){
            alert("Inner width of div: " + $("div").innerWidth());
        });
    });
    </script>
    </head>
    <body>
    
    <div style="height:100px;width:300px;padding:10px;margin:3px;border:1px solid blue;background-color:lightblue;"></div><br>
    
    <button>Display the inner width of div</button>
    <p>innerWidth() - returns the inner width of an element (includes padding).</p>
    
    </body>
    </html>
    

    In the above code when we click on button it get the inner Width of the div section of an element including padding not border and margin of the div in jquery.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: