I am generating a list using jquery-ui autocomplete. I would like to apply a custom class to this list so that I can refer to the first item in this list using a css selector like my_list:first-child.
I have tried the following code, but the class specifier on the li tag is being lost. Any suggestions? The similar questions on here talk about overloading renderItem with monkey patching but given all I want to do is specify a class attribute this seems excessive.
.data('autocomplete')._renderItem = ( ul, item ) ->
$( "<li class='my_list'></li>" )
.data( "item.autocomplete", item )
.append( '<a>' + item.label + '</a>' )
.appendTo( ul )
if you take a deep look of the output, you will get something like:
for such, a style like:
will do the trick:
Am I missing something on your question?