zoukankan      html  css  js  c++  java
  • Jquery学习笔记

    事件:

    1.live()事件:

      可以向一个网页中不存在的元素添加事件,存在的也可以

    例子:

    <html>
    <head>
    <script type="text/javascript" src="/jquery/jquery.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
      $("#test").load("click",function(){
        $(this).slideToggle();
      });
      $("button").click(function(){
        $("<p id='test'>This is a new paragraph.</p>").insertAfter("button");
      });
    });
    </script>
    </head>
    <body>
    <p>这是一个段落。</p>
    <p>点击任意 p 元素会令其消失。包括本段落。</p>
    <button>在本按钮后面插入新的 p 元素</button>
    <p><b>注释:</b>通过使用 live() 方法而不是 bind() 方法,新的 p 元素同样会在点击时消失。</p>
    </body>
    </html>

  • 相关阅读:
    Bootstrap 插件收集
    target和currentTarget
    微信小程序
    flex
    vue中使用icon和打包
    rem的使用
    vue中使用sass和compass
    vue父子组件传递参数
    weex
    常用软件&&网址
  • 原文地址:https://www.cnblogs.com/eryang/p/2582982.html
Copyright © 2011-2022 走看看