Q:

Find the total width of an element (including width, padding, and border) in jQuery

0

Find the total width of an element (including width, padding, and border) in jQuery.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

HTML Code :

<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-git.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Find total width of an element (including width, padding and border) in jQuery.</title>
</head>
<body>
<p id="myText">jQuery Exercises, Practice, Solution</p>
</body>
</html>

CSS Code:

p {
    padding-top: 50px;
    padding-right: 30px;
    padding-bottom: 50px;
    padding-left: 80px;
}

JavaScript Code:

console.log("Width + padding + borders : " + $("#myText").outerWidth());

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now