Autocomplete Html

How to display HTML is the results list of the Yii2 jQuery UI Autocomplete?

I want to display a small image, bold text, break tags and spans.

This works:




<?php $this->registerJs('


	$["ui"]["autocomplete"].prototype["_renderItem"] = function( ul, item) {

                return $( "<li></li>" )

                .data( "item.autocomplete", item )

                .append( $( "<a></a>" ).html( item.label ) )

                .appendTo( ul );

            };


');

?>