How to create a combo box with textbox and autocomplete feature in JavaScript ?


A simple HTML-JavaScript tutorial to create a combo-box that has also a textbox to take input from user. When user writes some text on the textbox, it shows a list of suggested values from the existing items of the combobox. 

This type of combo-box or drop down list is very useful when we want user to input some value besides the already exist items of the combobox.


<!DOCTYPE html>
<html>
 <head>
    
 <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" type="text/css" media="all" />
 
 <link rel="stylesheet" type="text/css" href="https://5bd43a8b85d977468b795ebb1cefd89e46ea7adb.googledrive.com/host/0B8sSQit1nMHNQUxrVnpfNWRXcUE/technologymantracombo.css" />
    
 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    
 <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
 
 <script type="text/javascript" src="https://5bd43a8b85d977468b795ebb1cefd89e46ea7adb.googledrive.com/host/0B8sSQit1nMHNQUxrVnpfNWRXcUE/technologymantracombo.js"></script>
 </head>
 
 <body>
 
 <select id="MySelect">
  <option>AMERICA</option>
  <option>INDIA</option>
  <option>JAPAN</option>
 </select>
 
 <script type="text/javascript">
  $(document).ready(function(){
   $("#MySelect").combify();
  });
 </script>
 
 </body>
</html>

Share on Google Plus

About Unknown

Hrishabh Sharma is the founder of an IT firm "Chanakya IT Solutions" that offers a variety of software,website,mobile-app solutions. He has more than 7 years of experience in software and web development. You can contact him at FACEBOOK or Send email at hrs.king@yahoo.in
    Blogger Comment
    Facebook Comment

1 comments: