jquery exercises

jQuery CSS - Find the outer height and outer width of an element

jQuery CSS : Exercise-7 with Solution

Find the outerHeight and outerWidth of an element.

Test Data :


Solution :

HTML Code :

<!DOCTYPE html>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
  <meta charset="utf-8">
  <title>Find the outerHeight and outerWidth of an element</title>
  div {
    width: 90px;
    height: 75px;
    margin: 5px;
  p {
    padding: 5px;
    border: 2px solid #666;

JavaScript Code :

$("p").text( "innerHeight:" +$("div").innerHeight()+" ::  innerWidth:" +$("div").innerWidth());

Live Demo:

See the Pen jquery-css-exercise-7 by w3resource (@w3resource) on CodePen.

Contribute your code and comments through Disqus.

Previous: Find the inner height and inner width of an element.
Next: Find an element that contains a specified class.

What is the difficulty level of this exercise?

New Content: Composer: Dependency manager for PHP, R Programming