简体   繁体   中英

Autocomplete doesn't work on Prestashop 1.6 custom module

I want to add the jquery ui module autocomplete on a input text. In my controller I add this line :

$this->context->controller->addJqueryUi('ui.autocomplete');

In my template, a test textbox :

test auto complete <input type="text" id="testautocomplete">

In my JS called by my template :

var dataSrc = ["australia", "austria", "antartica", "argentina", "algeria"];
    $("#testautocomplete").autocomplete({
        source:dataSrc
    });

But that don't work. I see in my source page this :

<input type="text" id="testautocomplete" autocomplete="off" class="ac_input">

I tried to add this in my JS $('#testautocomplete').attr("autocomplete", "on");

But still doesn't work.

Please help ! ;)

I could explain, but I think could be more useful for you take an idea from the module ps_searchbar in PS 1.7, check the file ps_searchbar.js which will serve as a guide to apply in your module.
If you have troubles loading the library, you can check the hookHeader of the file ps_searchbar.php .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM