Simply write down jquery to implement the carriage return event. The code is as follows:
Global:
$(function(){
document.onkeydown = function(e){
var ev = document.all ? window.event : e;
if(ev.keyCode== 13) {
$('#FormId).submit();//Handling events
}
}
});
A certain control:
$('#id').keydown(function(e) {
if(e.keyCode==13){
$('#FormId).submit(); //Handling events
}
});
if (window.event .keyCode==13) window.event.keyCode=0 //This will cancel the Enter key
If you want to simulate the Tab key, just write if (window.event.keyCode==13) window.event.keyCode=9 will do and it will jump to another element.
As we all know, if you want to jump to a certain page in easyui's Pagination, you only need to enter the page number and press ENTER to achieve the effect. In a project some time ago, the customer made a request and said that he wanted to enter the page number and press a GO button to jump. Well, customers are God, what do they say, we programmers can only do our best to achieve results. As shown in the picture:
That is: press GO to do the same thing as entering 3 and press Enter
This problem can be simplified to clicking an a tag to simulate the Pagination page number input box and pressing Enter. However, this event is written in jquery.easyui.min.js, and we have no way to call it directly; query the page number input box through chrome Yes
Then I checked the Event Object of the JQUERY API and found that jquery has a trigger method that can trigger simulated key events. Directly enter the code
easyui official website: http://www.jeasyui.com/index.php