TypeError autocomplete is not a function

0 votes

I am getting the TypeError: $(...).autocomplete is not a function when using the following code inside a Drupal module.

jQuery(document).ready(function($) { 
              $("#search_text").autocomplete({ 
                    source:results, 
                    minLength:2, 
                    position: { offset:'-30 0' }, 
                    select: function(event, ui ) { 
                                  goTo(ui.item.value); 
                                  return false; 
                } 
      }); 
});

jQuery should work and I have tried using a different variable for $ - any ideas what else might be the problem?


Drupal specific answer for autocomplete:

drupal_add_library('system', 'ui.autocomplete');

Feb 23 in JQuery by Rahul
• 9,240 points
788 views

1 answer to this question.

0 votes

You would definitely have missed the Jquery UI Library. Use CDN of Jquery UI or if you want it locally then download the file from Jquery UI as mentioned below:-

<link href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" rel="Stylesheet"> <script src="YourJquery source path"></script> 
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js" ></script>

answered Feb 23 by Aditya
• 7,660 points

Related Questions In JQuery

0 votes
1 answer

jQuery fix for "Uncaught TypeError: $ is not a function" error

We can fix this error by using jQuery() . ...READ MORE

answered Jun 1 in JQuery by Edureka
• 13,640 points
759 views
0 votes
1 answer

Jquery validation plugin - TypeError: $(...).validate is not a function

The "$(...). validate is not a function" ...READ MORE

answered Jun 28 in JQuery by rajatha
• 7,440 points
1,792 views
0 votes
1 answer

jQuery UI " $("#datepicker").datepicker is not a function"

The "$(...).datepicker is not a function" jQuery ...READ MORE

answered Jun 6 in JQuery by Edureka
• 13,640 points
144 views
0 votes
1 answer

$ is not a function - jQuery error

The typeerror: $ is not a function ...READ MORE

answered Jun 6 in JQuery by Edureka
• 13,640 points
81 views
0 votes
0 answers

jQuery UI DatePicker - Change Date Format

I am using the UI DatePicker from ...READ MORE

Jun 23 in Web Development by gaurav
• 18,960 points
101 views
0 votes
1 answer

jQuery dialog popup

This HTML is fine: <a href="#" id="contactUs">Contact Us</a> ...READ MORE

answered Jun 28 in Web Development by rajatha
• 7,440 points
37 views
0 votes
1 answer

Date range picker on jquery ui datepicker

Thanks I need this kind of code. ...READ MORE

answered Jun 27 in Web Development by rajatha
• 7,440 points
497 views
0 votes
1 answer

Loading gif in jQuery ajax call is not showing

Create a div with your image. Make it ...READ MORE

answered Jun 27 in Web Development by rajatha
• 7,440 points
203 views
0 votes
1 answer

Difference between $(window).load() and $(document).ready() functions

To answer your question, the document.ready is ...READ MORE

answered Feb 23 in JQuery by Aditya
• 7,660 points
239 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP