There is a textarea,
Java code
often defines onKeyPress="keypress();" and defines the following method.
var keypress = function(e){
var e = e || window.event;
var k = e.keyCode;
}
The method I use here is JQuery.
$("#text").bind("keyPress ",function(event){
var k = event.which;
});
The which used here is whether it is a single key or a combination in IE or FF. The key is pressed, and its value is 107
Then use String.fromCharCode(k) to get the pressed value.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn