开发者

How can i track what the users type without a input field? (jQuery)

开发者 https://www.devze.com 2022-12-15 12:15 出处:网络
All that the user is typing must be inserted to a div instead of a input field or a textarea. Btw. the user don\'t have to click anywhere to start typing, the user can just do it without any action.开

All that the user is typing must be inserted to a div instead of a input field or a textarea.

Btw. the user don't have to click anywhere to start typing, the user can just do it without any action.

开发者_开发百科

Sorry if it isn't understandable. (I'm not very good at english).

Thanks in advance.


Each key is associated with a keycode:

$(window).bind("keypress", function(e) {
  var code = (e.keyCode ? e.keyCode : e.which); // which code?
  alert(String.fromCharCode(code)); // which key, according to the code?
});
0

精彩评论

暂无评论...
验证码 换一张
取 消