Jump to content

Simple Autocomplete Function


Recommended Posts

Hello,

 

I want to add very basic autocomplete function to my prestashop module. What I want to achieve is:

 

city.php

<label for="city">City: </label>

And autocomplete.js

$(function() {
var availableTags = [
"London",
"Manchester",
"Liverpool",
];
$( "#city" ).autocomplete({
source: availableTags
});

I added autocomplete.js and jQuery library to my addon controler with:

$this->context->controller->addJqueryPlugin('autocomplete');
Tools::addJS(($this->_path).'js/auto.js');

Unfortunately, when Im trying to call my autocomplete function on input field, prestashop is adding autocomplete="off" to it. I was trying to add:

extraParams: {
ajaxSearch: 1,
id_lang: id_lang
}

to js but it's not working. Do anybody how how can I fix it?

 

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...