Gif loading

0

Hello

I'm implementing this autocomplete

And I would like that while the system searches the items, it shows a loading gif in the corner of the input.

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery UI Autocomplete - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script><scriptsrc="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <script>
  $( function() {
    var availableTags = [
      "ActionScript",
      "AppleScript",
      "Asp",
      "BASIC",
      "C",
      "C++",
      "Clojure",
      "COBOL",
      "ColdFusion",
      "Erlang",
      "Fortran",
      "Groovy",
      "Haskell",
      "Java",
      "JavaScript",
      "Lisp",
      "Perl",
      "PHP",
      "Python",
      "Ruby",
      "Scala",
      "Scheme"
    ];
    $( "#tags" ).autocomplete({
      source: availableTags
    });
  } );
  </script>
</head>
<body>
 
<div class="ui-widget">
  <label for="tags">Tags: </label>
  <input id="tags">
</div>
 
 
</body>
</html>

The line below in css works, but I do not know where to insert it:

.ac_loading {
    background: white url('indicator.gif') right center no-repeat;
}

This tutorial appears, only that its code is old and conflicts in some functions, which do not work but have what I would like to do:

$.Autocompleter.defaults = {
    inputClass: "ac_input",
    resultsClass: "ac_results",
    loadingClass: "ac_loading",

For example, this last code gives the following error:

Cannot read property 'opera' of undefined

That's it!

    
asked by anonymous 24.05.2017 / 22:06

1 answer

1

You can use the search methods to start your loading, and select to finish it from autocomplete.

$("#searchFirstTransactionStateInfo_searchPartnerId").autocomplete({
   search: function( event, ui ) {
        iniciaLoading();
    },
    select: function(event, ui) {
        finalizaLoading();   
    }
});

Useful links:

How to Initialize: link

How to complete: link

I hope I have helped.

    
25.05.2017 / 13:48