(037)jquery_dom选择器_before_after

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
  <head>
    <title>dom_after.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">
        
    </style>
    <script type="text/javascript" src="../js/jquery/jquery190.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            var $htmlBefore ="<span class='red'>小苹果1</span>";
            var $htmlAfter ="<span class='red'>小苹果2</span>";
            $(".green").before($htmlBefore);
            $(".green").after($htmlAfter);
        });
    </script>
  </head>
  
  <body>
        <h3>after()方法在元素之后插入内容</h3>
        <span class="green">我们交个朋友吧!</span>
  </body>
</html>

 

posted @ 2014-12-17 15:12  雪中飞雁  阅读(238)  评论(0)    收藏  举报