Tuesday, May 6, 2014

Autosuggestion with jQuery

The Autocomplete provides suggestions while you type into the field.


I have used simple javascript array.


Jquery Files

      <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
      <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
      <script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
      <script>
  $(function() {
    var availableTags = [
      "Java",
      "PHP",
      "Asp",
      "C",
      "Joomla",
      "Wordpress",
      "Drupal",
      "Magento",
      "Opencart",
      "JavaScript",
      "Cakephp"
    ];
    $( "#tag" ).autocomplete({
      source: availableTags
    });
  });
  </script>

HTML Code

 <label>Tags: </label>
      <input id="tag"/>
Please share your comments and feedback.Thanks.

No comments:

Post a Comment