Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function(){
- $('#searchMe').keyup(function(){
- lookup(this.value);
- });
- });
- function lookup(searchinput) {
- if(searchinput.length == 0) {
- // Hide the suggestion box.
- $("#suggestions").hide();
- } else {
- $('#loading').fadeIn();
- $.post("/RPCsearch.php", {queryString: ""+searchinput+""}, function(data){
- if(data.length > 0) {
- $("#suggestions").html(data).show();
- $('#loading').fadeOut();
- }
- });
- }
- } // lookup
- $(function() {
- var timer;
- $("#searchMe").keyup(function() {
- clearTimeout(timer);
- var ms = 200; // milliseconds
- var val = this.value;
- timer = setTimeout(function() {
- lookup(val);
- }, ms);
- });
- });
- OnKeyPress()
- txt = getTxt
- sleep(200)
- newTxt = getTxt
- if (txt == newTxt) // nothing has been typed so do something
- run my thing
- var delay = 200;
- var search_timer = null;
- $("#searchMe").keydown(function(e) {
- if(search_timer) {
- clearTimeout(search_timer);
- }
- search_timer = setTimeout(lookup, delay);
- });
- $("#searchMe").keypress(function(e) {
- if(search_timer) {
- clearTimeout(search_timer);
- }
- search_timer = setTimeout(lookup, delay);
- });
- $("#searchMe").keyup(function(e) {
- if(search_timer) {
- clearTimeout(search_timer);
- }
- search_timer = setTimeout(lookup, delay);
- });
- $(document).ready(function(){
- $("#searchMe").keyup(function () {
- try{window.clearTimeout(timeoutID);}catch(e){}
- timeoutID = window.setTimeout(run, 2000); //delay
- function run()
- { //dowhatev
- var text = $("#searchMe").val();
- //$("#showit").html(text);
- }
- });
- });
Add Comment
Please, Sign In to add comment