zoukankan      html  css  js  c++  java
  • JS/jQuery 之change、keypress、input和propertychange

    $(function(){
    /**
    * a、当前对象属性改变,并且是由键盘或鼠标事件激发的(脚本触发无效)
    * b、当前对象失去焦点(onblur)
    */
    $("#change").change(function(){
    console.log("change="+$(this).val());
    });

    /**
    * a、keypress/keydown/keyup监听键盘事件,鼠标复制黏贴操作无效
    */
    $("#keypress").keypress(function(){
    console.log("keypress="+$(this).val());
    });

    /**
    * a、input是标准的浏览器事件,一般应用于input元素,当input的value发生变化就会发生,无论是键盘输入还是鼠标黏贴的改变都能及时监听到变化
    * b、propertychange,只要当前对象属性发生改变。
    */

    $(".center").delegate(".center_comment" ,"input propertychange " ,function(){
      console.log ($(this).val())
      })

    });
    </script>
    </html>

  • 相关阅读:
    暗影精灵3安装无线网卡驱动(ubuntu16.04)
    装饰器之基本
    pyhton代码规范
    2.线程
    文件拾遗
    闭包函数
    6.文件基本操作
    1.socket网络编程
    9.异常处理
    Python语言规范
  • 原文地址:https://www.cnblogs.com/Young-shi/p/11121672.html
Copyright © 2011-2022 走看看