Autocomplete Search Engine in PHP, MYSQL and JAVASCRIPT -
good day! have here sample program gives output of autocomplete search engine illustrated in picture below of description. of content of autocomplete given which
"palawan","romblon","marinduque","mindoro","cagayan","batanes","nueva vizcaya","isabela","quirino"
and think not dynamic. want pull out of data in column(provinces) table(tb_places) , put autocomplete engine.
the purpose of autocomplete inform user data may search using search engine. everyone
<?php $con = mysqli_connect('localhost,'root','','category'); ?> <!doctype html> <html lang="en"> <head> <style type="text/css"> tags { span.label{ font-weight: bold; color: #000;} </style> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <link rel="stylesheet" type="text/css" href="../font/font-awesome-4.7.0/css/font-awesome.css"> <link rel="stylesheet" href="/resources/demos/style.css"> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <script src="js/custom.js"></script> <script src="js/jquery.js"></script> <script> $( function() { var availabletags = ([ "palawan", "romblon", "marinduque", "mindoro", "cagayan", "batanes", "nueva vizcaya", "isabela", "quirino" ]); $(this).autocomplete({ source: availabletags, }).autocomplete("instance")._renderitem = function(ul, item) { return $("<li>") .append("<div>" + item.label + "<span style='float: right'><i class='fa fa-trash'></i></span></div>") .appendto(ul); }; $( "#tags" ).autocomplete({ source: availabletags, }).autocomplete("instance")._renderitem = function(ul, item) { return $("<li>") .append("<div>" + ' ' + ' ' + item.label + "<span style='float: left'><i class='fa fa-map-marker'></i></span></div>") .appendto(ul); }; } ); </script> </head> <body> <div class="ui-widget"> <label for="tags" > location: </label> <input id="tags" > </div> </body> </html>
Comments
Post a Comment