Prechádzať zdrojové kódy

搜索改成回车提交,防止卡死情况

laiguoran 3 rokov pred
rodič
commit
9b3ce1dfa9
1 zmenil súbory, kde vykonal 14 pridanie a 4 odobranie
  1. 14 4
      app/public/js/change_information_set.js

+ 14 - 4
app/public/js/change_information_set.js

@@ -812,8 +812,13 @@ $(document).ready(() => {
         $('#code-list').html('');
         $('#code-select-all').prop('checked', false);
     });
-
-    $('#list-input').on('valuechange', function (e, previous) {
+    // 回车提交
+    $('#list-input').on('keypress', function () {
+        if(window.event.keyCode === 13) {
+            $(this).blur();
+        }
+    });
+    $('#list-input').on('blur', function (e, previous) {
         const select = parseInt($('#select-list').val());
         const value = $(this).val();
         let showListData = changeListData;
@@ -842,8 +847,13 @@ $(document).ready(() => {
         $('#code-list').html('');
         $('#code-select-all').prop('checked', false);
     });
-
-    $('#code-input').on('valuechange', function (e, previous) {
+    // 回车提交
+    $('#code-input').on('keypress', function () {
+        if(window.event.keyCode === 13) {
+            $(this).blur();
+        }
+    });
+    $('#code-input').on('blur', function () {
         const value = $(this).val();
         if (value !== '') {
             $(this).siblings('a').show();