zoukankan      html  css  js  c++  java
  • on的用法

    <!DOCTYPE html>
    <html>
    <head>
    <script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
      <meta charset="utf-8">
      <title>JS Bin</title>
    </head>
    <body>
      <a class='alink' href='#'>发送验证码</a>
    </body>
    </html>
    

    css

    a{ display:box; display:-webkit-box; box-pack:center; box-align:center; 100px; height:100px; -webkit-box-pack:center; -webkit-box-align:center;}
    .alink{ background-color:red;}
    .disable{ background-color:grey;}
    

    js

    $(function(){
       $(document).on('click','a.disable',function(){  //只执行333,222不执行
          alert(333);
      });  
      $('a.alink').on('click',function(){
          $(this).addClass('disable');
      });
     
      $('a.disable').on('click',function(){  //对静态元素有效,但是绑定动态生成的a元素的事件时无效:
          alert(222);
      });
    
    });
    

      

      http://jsbin.com/xowafesoxi/2/

      

  • 相关阅读:
    PHP中的闭包详解
    PHPDoc 学习记录
    php中注释有关内容
    命名空间 转
    php命名空间学习笔记。
    php命名空间详解
    命名空间
    php作用域限定符
    nginx负载均衡
    naginx安装入门
  • 原文地址:https://www.cnblogs.com/positive/p/4182052.html
Copyright © 2011-2022 走看看