当前位置:编程学习 > JS >>

jquery append()用法

append()前面是要选择的对象,后面是要在对象内插入的元素内容
返回值
jQuery

参数
content (String, Element, jQuery) : 要追加到目标中的内容

示例
向所有段落中追加一些HTML标记。

<html>
  <head>
    <script type="text/网页特效" src="js/jquery-1.3.2.js"></script>
    <script type="text/javascript">
   
        $(document).ready(function(){
              $("div").hover(
                  function () {
                    $(this).append($("<span> ***</span>"));
                  },
                  function () {
                    $(this).find("span:last").remove();
                  }
             );

 


        });
    </script>


  </head>
  <body>
    <body>
       <div><h1>header 1</h1></div>
    </body>
</html>

补充:网页制作,jquery 
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,