How can I create an autocomplete input text in lightning component Please help either by suggest library or create one from scratch

I tried this: https://gist.github.com/peterknolle/ef17727d994332a8ef6b#file-autccomplete-cmp

but it said that ' $j is not defined'

and also tried the one in lightning design system but it does not work and even its style is bad ( see image): https://www.lightningdesignsystem.com/components/lookups/

enter image description here

  • In the first look you provided, it requires to add JQuery as a static resource. Did you add it? Jul 31, 2017 at 8:56
  • yes I added jquery, but not same, I added jquery 2.2.4 because it is the one that compatible with locker service
    – sundus
    Jul 31, 2017 at 9:22
  • Are you sure you imported well here? <aura:requires baseUrl="/resource/" scripts="{jquery:'jquery/jquery.js',jqueryui:'jqueryui/jquery-ui.js'}" deps="{jqueryui:['jquery']}" styles="{jqueryui:'jqueryui/jquery-ui.css'}" requiresReady="c.init" /> Jul 31, 2017 at 9:26
  • Here is a great component from Philippe Ozil: github.com/pozil/sfdc-ui-lookup-lwc. Sharing the link as it might help someone. Jul 24, 2019 at 21:17

2 Answers 2


Find Below link , Its small demo on auto complete on account lookup using lightning. Full source present in git hub, with guidance. This will help you.

Reference Lookup auto complete


Another fantastic option is Philippe Ozil's lookup component. You can also leverage lightning:inputField or lightning:recordForm to do a lookup for you as well, and then catch the value and process it on your own.

These options are laid out in this post

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .