Opened 6 years ago

Closed 6 years ago

#15054 closed bug (notabug)

documentation for jquery autocomplete

Reported by: pgee70 Owned by:
Priority: minor Milestone: none
Component: ui.autocomplete Version: 1.11.3
Keywords: Cc:
Blocked by: Blocking:

Description

the code example for https://api.jqueryui.com/autocomplete/#method-_renderItem shows

_renderItem: function( ul, item ) {
  return $( "<li>" )
    .attr( "data-value", item.value )
    .append( item.label )
    .appendTo( ul );
}

but the item won't select because the item is not wrapped in an anchor tag.

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

would work.

Change History (1)

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

Component: ui.coreui.autocomplete
Resolution: notabug
Status: newclosed

That documentation is for jQuery UI 1.12, which does not use anchors. Anchors have not been needed since 1.10. See http://jqueryui.com/upgrade-guide/1.11/#remove-the-requirement-to-use-anchors-in-menu-items

Note: See TracTickets for help on using tickets.