Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#6753 closed enhancement (duplicate)

Reinstate HTML labels (and query highlighting)

Reported by: draenor Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.core Version: 1.8.7
Keywords: Cc:
Blocked by: Blocking:

Description

Reinstate (as in jQuery UI 1.8.2) HTML labels when plotting the result. Thus allowing e.g., rendering objects such as

{
  value: test
  label: <b>te</b>st
}

assuming that the "te" is the search term.

Proposed fix:

_renderItem: function( ul, item) {
                return $( "<li></li>" )
                    .data( "item.autocomplete", item )
                    .append( "<a>" + item.label + "</a>" )
                    .appendTo( ul );
            }


Even better would be to support this highlighting the query term directly in the autocomplete module.

Proposed fix 2

(requires the first fix)

  var termregex = new RegExp( "(" + term + ")", "i" ),
  this.label = this.label.replace( termregex, "<b>$1</b>" );

Change History (2)

comment:1 Changed 9 years ago by Scott González

Resolution: duplicate
Status: newclosed

comment:2 Changed 9 years ago by Scott González

Duplicate of #5918.

Note: See TracTickets for help on using tickets.