While styling the jQuery autocomplete plugin, I get the following HTML code hardwired to my page:
<ul class="ui-autocomplete ui-menu ui-widget ui-widget-content ui-corner-all" role="listbox" aria-activedescendant="ui-active-menuitem" style="z-index: 1; top: 0px; left: 0px; display: none; "></ul>
How can I disable styling from being made through HTML and keep it done via CSS? I don't think my CSS files are overwriting that style.
Any help will do
The autocomplete (options) method declares that an HTML <input> element must be managed as an input field that will be displayed above a list of suggestions. The options parameter is an object that specifies the behavior of the list of suggestions when the user is typing in the input field.
Syntax: $("TagId"). autocomplete({ source : itemList // List of Words. })
a jQuery UI widget is a specialized jQuery plug-in. Using plug-in, we can apply behaviours to the elements. However, plug-ins lack some built-in capabilities, such as a way to associate data with its elements, expose methods, merge options with defaults, and control the plug-in's lifetime.
jQuery autocomplete needs to set some inline styles to position the drop down list under the text box and size it equally.
It doesn't set anything else, so it's completely up to you to provide visual styling of it by setting styles of those classes that are added to it (ie. ui-autocomplete
).
What I'm trying to tell you is this: set the visual aspects of the drop down list that gets displayed and don't worry about positioning and sizing inline styles.
If you do need to override positioning and sizing of this element you can always set your styles as !important
.
ul.ui-autocomplete
{
position: absolute;
left: 100px!important;
top: 0!important;
...
}
Setting margin-top
doesn't do anything since it calculates position every single time it displays the drop down. But you can try setting this:
.ui-autocomplete
{
border-top:5px solid transparent!important;
}
This actually does the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With