Try to search your question here, if you can't find : Ask Any Question Now ?

JQuery autocomplete displays all items, won't filter while typing

HomeCategory: stackoverflowJQuery autocomplete displays all items, won't filter while typing
Avatargaurav asked 3 months ago

I am using JQuery UI autocomplete plugin on my web app. I was able to make it work, but the problem is, whenever I type in the textbox, all the items from my array are displayed. What I want to do is whatever I input in the textbox, I want to get all the matching items while typing.

this is my code

var products= [
              {"id":1,"value":"VITA.E D-ALPHA 400 UI X 30S","code":"00019","barcode":null,"case_cost":"168.00","pack_cost":"168.00","piece_cost":"5.60"},
              {"id":2,"value":"NATTOKIN 1000MG SOFTGELX6S","code":"0005","barcode":null,"case_cost":"0.00","pack_cost":"0.00","piece_cost":"0.00"},
              {"id":3,"value":"LIVERMARIN PLUS 1000MGX6S","code":"0006","barcode":null,"case_cost":"0.00","pack_cost":"0.00","piece_cost":"0.00"},
              {"id":4,"value":"LIVERMARIN PLUS X30S","code":"00063","barcode":null,"case_cost":"528.00","pack_cost":"528.00","piece_cost":"17.60"},
              {"id":5,"value":"NATTOKIN X 30S","code":"00065","barcode":null,"case_cost":"840.00","pack_cost":"840.00","piece_cost":"28.00"},
              {"id":6,"value":"OMEGAMAX 12X30S","code":"00067","barcode":null,"case_cost":"5472.00","pack_cost":"456.00","piece_cost":"15.20"}

    source : function(req,res){
        res($.map(products, function(item){
                value : item.code,
                label : item.value,
                description : item.value,
                case_cost : item.case_cost,
                piece_cost : item.piece_cost,
                pack_cost : item.pack_cost
    select : function(ev,ui){
        //some codes here

}).focus(function() {
    $(this).autocomplete("search", $(this).val());
1 Answers
Best Answer
AvatarMikhail answered 3 months ago
Your Answer

16 + 2 =

Popular Tags

WP Facebook Auto Publish Powered By :