Topic: Correct way to set autocomplete value

Watts free asked 4 years ago

Expected behavior

What's the correct way to dynamically set an autocomplete value from jquery. The following command:


See Snippet - It does not set the field value as if it was selected by a user. The label overlaps and the cross button doesn't show.

P.S. This would be good to add to documentation.


Actual behavior

See snippet

Resources (screenshots, code snippets etc.)

Mateusz Łubianka staff answered 4 years ago

Hi @Watts,

Try to use this code:



Watts free commented 4 years ago


The final step was:

$('.mdb-autocomplete-wrap li').trigger('click')

Mateusz Łubianka staff commented 4 years ago

I'm glad I could help.


Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.14.1
  • Device: DESKTOP
  • Browser: Chrome
  • OS: Linux
  • Provided sample code: No
  • Provided link: Yes