Javascript examples for jQuery Method and Property:innerHeight
Display dimensions of div
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ var txt = ""; txt += "Width of div: " + $("#div1").width() + "</br>"; txt += "Inner width of div: " + $("#div1").innerWidth() + "</br>"; txt += "Outer width of div: " + $("#div1").outerWidth() + "</br>"; txt += "Outer width of div (margin included): " + $("#div1").outerWidth(true) + "</br>" + "</br>"; txt += "Height of div: " + $("#div1").height() + "</br>"; txt += "Inner height of div: " + $("#div1").innerHeight() + "</br>"; txt += "Outer height of div: " + $("#div1").outerHeight() + "</br>"; txt += "Outer height of div (margin included): " + $("#div1").outerHeight(true) + "</br>"; $("#div1").html(txt); });/*from ww w . j a v a 2s.c o m*/ }); </script> </head> <body> <div id="div1" style="height:180px;width:300px;padding:10px;margin:4px;border:2px solid blue;background-color:red;"></div> <br> <button>Display dimensions of div</button> </body> </html>