不应使用keyup事件的'charCode'属性.该值是没有意义的 [英] The 'charCode' property of a keyup event should not be used. The value is meaningless

查看:112
本文介绍了不应使用keyup事件的'charCode'属性.该值是没有意义的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HTML代码:

<input type="text" id="secrecy" name="secrecy" size="3" maxlengh="3" />Days

jQuery代码:

$('#secrecy').keyup(function(){
alert("ok");    
});

错误消息:

键的'charCode'属性 事件不应该使用.值是 毫无意义.

The 'charCode' property of a keyup event should not be used. The value is meaningless.

Jquery代码不起作用.当我在保密"中输入内容时,没有发出警报.怎么了?

The Jquery code doesn't work.When I input something into "secrecy", an alert doesn't come out.What's wrong?

推荐答案

您是否正在等待绑定事件,直到Dom准备就绪?

Are you waiting to bind the event until the Dom is ready?

类似的事情可能会有所帮助:

Something like this might help:

$(document).ready(function(){
  $('#secrecy').keyup(function(){
    alert("ok");    
  });
});

这篇关于不应使用keyup事件的'charCode'属性.该值是没有意义的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆