tanzongbiao 2022-05-14 15:17:23 阅读数:928
js Get the element where the cursor is located
var focusTemp = $("input:focus");
Examples of use
// Compatible section 2 Enter to inquire
// The cursor is input Position of elements (HTMLInputElement)
var htmlTemp = $("input:focus")[0];
if(htmlTemp != undefined
&& (htmlTemp.id == "studentName"
|| htmlTemp.id == "studentIdCard"
)){
// The first 2 Enter to inquire
$('#btn_Search2').click();
}else{
// Press enter on the original full page to query
$('#btn_Search').click();
}
Full page Enter query Multiple carriage return queries
// Empty
$("#btn_Clear").click(function() {
$("#form_Condition").resetForm();
});
// Inquire about (button On in mode ,submit Off mode ,bug, Button is submit Can't bind anymore , Because it is bound by default , Rebinding will lead to query 2 Time )
$("#btn_Search").click(function() {
$("#tb_TableStudent").bootstrapTable('refresh');
});
// Enter to inquire (button Pattern )( Full page - Solve the problem that the drop-down box and date selection cannot enter the query )
document.onkeydown = function (e) {
var theEvent = e || window.event;
var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
if (code == 13) {
// Compatible section 2 Enter to inquire
// The cursor is input Position of elements (HTMLInputElement)
var htmlTemp = $("input:focus")[0];
if(htmlTemp != undefined
&& (htmlTemp.id == "studentName"
|| htmlTemp.id == "studentIdCard"
)){
// The first 2 Enter to inquire
$('#btn_Search2').click();
}else{
// Press enter on the original full page to query
$('#btn_Search').click();
}
}
};
// Empty 2
$("#btn_Clear2").click(function() {
$("#form_Condition2").resetForm();
});
// Inquire about (button On in mode ,submit Off mode ,bug, Button is submit Can't bind anymore , Because it is bound by default , Rebinding will lead to query 2 Time )
$("#btn_Search2").click(function() {
$("#tb_Table").bootstrapTable('refresh');
});
版权声明:本文为[tanzongbiao]所创,转载请带上原文链接,感谢。 https://car.inotgo.com/2022/134/202205141513182187.html