jquery - Materializecss Autocomplete Input -
why autocomplete inputbox working have idea fix it, code:
<!doctype html> <html lang="en"> <head> <title>site name</title> <link href="http://fonts.googleapis.com/icon?family=material+icons" rel="stylesheet"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.2/css/materialize.min.css"> <link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet"> </head> <body> <nav class="blue"> <div class="nav-wrapper"> <a href="/index" class="brand-logo">site name</a> <a href="#" data-activates="mobile-demo" class="button-collapse"><i class="material-icons">menu</i></a> <ul class="right hide-on-med-and-down"> <li><a href="/index">index</a></li> </ul> <ul class="side-nav" id="mobile-demo"> <li><a href="/index">index</a></li> </ul> </div> </nav> <br><br> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <!-- 33 kb --> <style> .loader { position: fixed; left: 0px; top: 0px; width: 100%; height: 100%; z-index: 10; background: url('/images/480.gif') 50% 50% no-repeat #fff; opacity: 100%; } </style> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script> <script type="text/javascript"> $(window).load(function() { settimeout(function(){ $('.loader').remove(); }, 3000); }); </script> <div class="loader"><center><br><br><br>please wait.<br></center></div> <div class="row"> <div class="col s12"> <div class="row"> <div class="input-field col s12"> <i class="material-icons prefix">textsms</i> <input type="text" id="autocomplete-input" class="autocomplete"> <label for="autocomplete-input">autocomplete</label> </div> </div> </div> </div> <br> <script src="//code.jquery.com/jquery-2.1.1.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/materialize/0.98.2/js/materialize.min.js"></script> <script> $(".button-collapse").sidenav(); </script> <script> $('.button-collapse').sidenav({ menuwidth: 300, // default 300 edge: 'right', // choose horizontal origin closeonclick: true, // closes side-nav on <a> clicks, useful angular/meteor draggable: true, // choose whether can drag open on touch screens, onopen: function(el) { /* stuff* / }, // function called when sidenav opened onclose: function(el) { /* stuff* / }, // function called when sidenav closed } ); </script> <script> $('input.autocomplete').autocomplete({ data: { "apple": null, "microsoft": null, "google": 'https://placehold.it/250x250' }, limit: 20, // max amount of results can shown @ once. default: infinity. onautocomplete: function(val) { // callback function when value autcompleted. }, minlength: 1, // minimum length of input autocomplete start. default: 1. }); </script> </body> </html>
i tryed methods no results, change materializecss version of stylesheet , script again dont worked, tryed other autocomplete dont work tryed https://www.codexworld.com/autocomplete-textbox-using-jquery-php-mysql/ dont work materializecss.
try add this:
$(document).ready(function() { [your code here] });
it wait till page loaded before executing code.
also, version of jquery have? said delete 2 of 3 references.
Comments
Post a Comment