0
$(".someClassWithMultipleItemsOnDOM").autocomplete({ 

     minLength:2, 
     source .....(ajax call) 
     ..... 
}).focus(function() { 
      /*some code*/ 

     }) 
.data("autocomplete")._renderItem = function(ul, item) { 
/*render item for making search text bold*/ 

}; 
.data("autocomplete")._resizeMenu = function() { 
     /*resize code to set the size of autocosearch drop down box*/ 
     }; 

我收到
在調整大小菜單行的錯誤,有語法錯誤,,有什麼辦法也使用這兩個功能在一起。以類似的方式。如何使用兩個數據(「自動完成」)即renderitem和調整一起

+0

語法錯誤是因爲第二個'.data'在它之前沒有任何對象。 – Barmar

回答

3

您可以像這樣使用_renderItem和_resizeMenu。

var tag = $("#domId").autocomplete({ 
       source:........... 
    }); 
    tag.data("autocomplete")._renderItem = function (ul, item) { 
       /* Your code*/ 
    }; 
    tag.data("autocomplete")._resizeMenu = function() { 
       /* Your code*/ 
    }; 

看看這個網站JQFAQ,它會對jQuery開發者更有用。

相關問題