Today, I want to implement a carriage return event. I started to use the js method, but it didn't work. Originally, JQuery was a little different from JS, And it was much simpler than JS to simply write down jquery's implementation of carriage return events, the Code is as follows:
Global:
The Code is as follows:
$ (Function (){
Document. onkeydown = function (e ){
Var ev = document. all? Window. event: e;
If (ev. keyCode = 13 ){
$ ('# FormId). submit (); // process the event
}
}
});
A control:
The Code is as follows:
$ ('# Id'). keydown (function (e ){
If (e. keyCode = 13 ){
$ ('# FormId). submit (); // process the event
}
});
If (window. event. keyCode = 13) window. event. keyCode = 0 // then the Enter key is canceled.
If you want to simulate the Tab key, you just need to write it as if (window. event. keyCode = 13) window. event. keyCode = 9, and it will jump to another element.
As we all know, in Pagination of easyui, to jump to a page, you only need to ENTER the page number and press ENTER to achieve the effect. Some time ago, the project customer requested to enter the page number and press the GO button to redirect. Well, the customers are God. What do they say about us, these programmers can only do their best to achieve the results.
That is, press GO to input 3 and press Enter.
This problem can be simplified to clicking a label to simulate Pagination page number input box press enter, but this event is written in jquery. easyui. min. js, We can't directly call it; the page number input box found through chrome is
The Code is as follows:
Then, we checked the Event Object of jquery api and found that jquery has a trigger method that can trigger simulated button events. Directly Add code
The Code is as follows: