zoukankan      html  css  js  c++  java
  • 表单输入实时检测

    <input type="text"  />

    $('input').on('input propertychange', function() {
      console.log('打印');
    });

    延伸知识:

    1、回车提交绑定:

    标签上添加:onfocus="document.onkeydown = ifFocus" onblur="document.onkeydown = null;"

    如:<input type="text" id="userId" placeholder="请输入你要查询的用户ID" onfocus="document.onkeydown = ifFocus" onblur="document.onkeydown = null;" />

    相关脚本:

    function ifFocus(){
      var e = event || window.event || arguments.callee.caller.arguments[0];
      if(e && e.keyCode==13){
        alert('按了回车');
      }
    }

  • 相关阅读:
    7段数码管绘制
    画五角星
    绘制正方形
    蟒蛇的绘制
    玫瑰花
    小猪佩奇
    数列求和
    水仙花数
    鸡兔同笼
    画国际象棋盘
  • 原文地址:https://www.cnblogs.com/waitingbar/p/4849836.html
Copyright © 2011-2022 走看看