(040)jquery_dom选择器_wrap_wrapInner

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
  <head>
    <title>dom_wrap.html</title>
    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
    <style type="text/css">
        span
        {
            color: white;
            padding: 8px;
        }
        .red
        {
            background-color: Red;
        }
    </style>
    <script type="text/javascript" src="../js/jquery/jquery190.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $(".red").wrap("<div></div>"); //外层包裹div
            $(".red").wrapInner("<i></i>"); //i标签包裹内容
        });
    </script>
  </head>
  
  <body>
        <h3>使用wrapInner()方法包裹元素</h3>
        <span class="red" title='hi'>我的身体有点歪</span>
  </body>
</html>

 

posted @ 2014-12-18 10:09  雪中飞雁  阅读(165)  评论(0)    收藏  举报