javascript - How to close autocomplete dropdown on side click -


i user jquery autocomplete fetch results , results displayed when click on side can't close dropdown returned results.

$(function () {             $("#search").autocomplete({                 source: function (request, response) {                     $.ajax({                         url: '@url.action("testautocomplete", "home")', type: "post", datatype: "json",                         data: { query: request.term },                         success: function (data) {                             response($.map(data, function (item) {                                  return {                                     label: item.title                                 };                             }));                         }                     });                 },                 minlength: 1,                 select: function (event, ui) {                     onitemselect(ui.item);                 },                 open: function () {                     $(this).removeclass('ui-corner-all').addclass('ui-corner-top');                     $(this).autocomplete('widget').css('z-index', 999999);                 },                 close: function () {                     $(this).removeclass('ui-corner-top').addclass('ui-corner-all');                 }             })         .data('ui-autocomplete')._renderitem = function (ul, item) {             return $('<li>')                 .data('autocomplete-item', item)                 .append('<a href="#"><p  >' + item.label + "</p></a>")                 .appendto(ul);         };         }); 

very stupid error.

 $("#search").autocomplete({... 

it should

 $(".search").autocomplete({... 

and work.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -