Created
September 25, 2018 07:04
-
-
Save guimeisang/7c93f74e516665c5db80569786953e09 to your computer and use it in GitHub Desktop.
// source https://jsbin.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="防抖功能的题目"> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>debounce</title> | |
</head> | |
<body> | |
<input type="text" name="keyword" id="j-input" /> | |
<script id="jsbin-javascript"> | |
// 请完善以下代码中的防抖方法 | |
// 当在文本框输入关健词过程中停顿 2 秒后触发自动搜索 | |
var ele = document.getElementById('j-input'); | |
ele.addEventListener('keyup', debounce(function(e) { | |
console.log('search keyword: ' + this.value); | |
}, 2000)); | |
function debounce(fn, delay){ | |
} | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">// 请完善以下代码中的防抖方法 | |
// 当在文本框输入关健词过程中停顿 2 秒后触发自动搜索 | |
var ele = document.getElementById('j-input'); | |
ele.addEventListener('keyup', debounce(function(e) { | |
console.log('search keyword: ' + this.value); | |
}, 2000)); | |
function debounce(fn, delay){ | |
} | |
</script></body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 请完善以下代码中的防抖方法 | |
// 当在文本框输入关健词过程中停顿 2 秒后触发自动搜索 | |
var ele = document.getElementById('j-input'); | |
ele.addEventListener('keyup', debounce(function(e) { | |
console.log('search keyword: ' + this.value); | |
}, 2000)); | |
function debounce(fn, delay){ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment