How to use height() Method in JQuery

In this article, I will explain use of height() Method in JQuery.
  • 1050

JQuery CSS height() Method

height() method set set and return the height of selected elements.

Syntax

$(selector).height()

Example

The following example shows how to height() method using function in jquery.

<!DOCTYPE html>

<html>

<head>

<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">

    $(document).ready(function () {

        $("button").click(function () {

            alert($("p").height());

        });

    });

</script>

</head>

<body>

<p style="font-size:large">This is a height method example.</p>

<button>Click for get the height of the p element</button>

</body>

</html>

 

Output


simple height.jpg

 Further Readings

You may also want to read these related articles here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

© 2013 dotNetheaven. All rights reserved.