显示标签属性

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        #show{
            width:600px;
            height: 220px;
            background-color: darkseagreen;
            border: darkgreen 1px solid;
        }

    </style>
    <script src="js/jquery-1.11.3.min.js"></script>
    <script>
        $(function (){
           var text="";
           text += "DIV宽" + $("#show").width() + "<br>";

           text +=  "DIV高" +$("#show").height() + "<br>";
           $("#btn").click(function (){
               $("#show").html(text);
           })
        });
    </script>
</head>
<body>
    <div id="show"></div>
    <button id="btn">显示DIV的尺寸</button>
</body>
</html>
原文地址:https://www.cnblogs.com/bingxing/p/13494166.html