Home  >  Article  >  Web Front-end  >  jquery keypress,keyup,onpropertychange keyboard event_jquery

jquery keypress,keyup,onpropertychange keyboard event_jquery

WBOY
WBOYOriginal
2016-05-16 18:24:331144browse

At first, I used the onkeyup event of js, but it was never triggered. I don’t know where else the event is monitored. The js event can be delivered and blocked. It’s quite troublesome and there are too many situations. After searching for a long time, I finally found a solution, which can be solved through the onpropertychange event.

Copy code The code is as follows:

$("#textboxID").bind("onpropertychange ", function(){
//alert( $(this).text() );
//Automatically intercepted logic code
});

firefox does not onpropertychange
The following is a code that is easier to use and has better compatibility
Copy the code The code is as follows:

jQuery("#txtContent").keypress(function() {
}).keyup(function() {
});
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