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 wd = $('#mydiv').innerWidth(); alert("The innerWidth of div is " + wd ); //set new innerWidth $('#mydiv').innerWidth(400); }); }); </script> </head> <body> <h1>jQuery Manipulation Methods: innerWidth()</h1> <div id="mydiv" style="background-color: aquamarine;"> This is div </div> <button>Click Here to Test .innerWidth()</button> </body> </html>
Result: