jQuery 包裹节点

<script src="Scripts/jquery-1.11.3.js"></script>
    <script type="text/javascript">
        $(function () {
           $("p").wrap("<div style='background-color:aqua;'></div>")
        });
    </script>
</head>
<body>
    <p  title="请选择喜欢的水果">水果列表 </p>
    <ul>
        <li title="苹果">苹果</li>
        <li title="橘子">橘子</li>
        <li title="西瓜121">西瓜</li>
    </ul>
</body>


猜你喜欢

转载自blog.csdn.net/mogul1/article/details/80963062