jQuery UI - Autocomplete generated inline style override?

守給你的承諾、 提交于 2019-11-28 10:43:14

问题


I'm using jQuery Autocomplete plugin which, generates following markup when suggestions show up.

<ul class="ui-autocomplete ui-menu ui-widget ui-widget-content ui-corner-all" role="listbox" aria-activedescendant="ui-active-menuitem" style="z-index: 16; width: 1355px; position: relative; top: -1615px; left: 40px; display: none; ">
    <li class="ui-menu-item" role="menuitem">
        <a class="ui-corner-all" tabindex="-1">java</a>
    </li>
    <li class="ui-menu-item" role="menuitem">
        <a class="ui-corner-all" tabindex="-1">javascript</a>
    </li>
</ul>

My understanding is, it's using the UI Position plugin to position it relative to the input field. But inside generated style="z-index: 16; width: 1355px; position: relative; top: -1615px; left: 40px; display: none; ", width is much longer than my input field. Since this is inline styles added by the module, I can not override this using ui-autocomplete selector. Any ideas?


回答1:


Use the !important method in css: e.g.

.ui-autocomplete {
    width:200px !important;
}


来源:https://stackoverflow.com/questions/8071991/jquery-ui-autocomplete-generated-inline-style-override

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!