设置自动宽度 - jQuery自动完成

时间:2012-05-22 06:48:23

标签: jquery autocomplete

如何在jQuery自动完成选项中设置自动宽度?

$('#'+pmId).autocomplete('mst_get_masterinfo.php?vValid=15&vRetType=1&vCategory='+vCatCode,{
      delay:10,
      cacheLength: 0,
      width:200,// Width Option
      mustMatch:true,
});

1 个答案:

答案 0 :(得分:3)

我曾使用open选项执行此操作,该选项在菜单打开后触发。

$('#'+pmId).autocomplete('mst_get_masterinfo.php?vValid=15&vRetType=1&vCategory='+vCatCode,{
    delay:10,
    cacheLength: 0,
    mustMatch:true,
    open: function() { 
        // After menu has been opened, set width to 100px
        $('.ui-menu')
            .width(100);
    }  
});