mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-05 22:44:22 +08:00
Add timeout to search
This commit is contained in:
parent
1ccabf62b3
commit
03b81400a9
1 changed files with 7 additions and 1 deletions
|
@ -55,9 +55,15 @@ function setDefaultViewState() {
|
|||
|
||||
// Apply AJAX callbacks onto the search box
|
||||
function applySearchCallback() {
|
||||
var timeout;
|
||||
// Submit form on every input in the search box
|
||||
$('input[name="key"]').off('input').on('input', function() {
|
||||
$('form.protocols-search-bar').submit();
|
||||
if (timeout)
|
||||
clearTimeout(timeout)
|
||||
|
||||
timeout = setTimeout(function() {
|
||||
$('form.protocols-search-bar').submit();
|
||||
}, 500);
|
||||
});
|
||||
|
||||
// Submit form when clicking on sort buttons
|
||||
|
|
Loading…
Reference in a new issue