Home
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script> $(document).ready(function () { $("button").click(function () { //get innerWidth var inrWidth = $('#mydiv').innerWidth(); var outerWidth = $('#mydiv').outerWidth(); alert("The innerWidth of div is " + innerWidth + " and outerWidth is"+outerWidth ); //set new outerWidth $('#mydiv').outerWidth(400); }); }); </script> </head> <body> <h1>jQuery Manipulation Methods: outerWidth()</h1> <div id="mydiv" style="background-color: aquamarine;"> This is div </div> <button>Click Here to Test .innerWidth()</button> </body> </html>
Result: