asp.net - Jquery UI autocomplete with web form -


i'm using jquery ui autocomplete in asp.net web form, searching image repository resulting in list imagethumb , title.

<script type="text/javascript">     $(document).ready(function () {         searchtext();     });     function searchtext() {         $(".autosuggest").autocomplete({             source: function (request, response) {                 $.ajax({                     type: "post",                     contenttype: "application/json; charset=utf-8",                     url: "service.asmx/search",                     data: "{'searchtext':'" + document.getelementbyid('txtsearch').value + "'}",                     datatype: "json",                     success: function (data) {                         response($.map(data.d, function (item) {                             return {                                 pageno: item.pageno,                                 imageurl: item.imageurl                             };                         }));                      },                     error: function (result) {                         alert("error");                     }                 });             },             focus: function( event, ui ) {                 $("ul li a").value;                   return false;            },         }).data('autocomplete')._renderitem = function (ul, item) {             return $('<li>')             .data('item.autocomplete', item)             .append("<a><img src='" + item.imageurl + "' />" + item.pageno + "</a>")             .appendto(ul);         };     } </script> 

html

     <div>     search:     <input type="text" id="txtsearch" class="autosuggest" />      </div> 

it's working fine, when select item, doesn't fill in text box. going wrong? appreciated.

write selection event autocomplete also

select: function(event, ui) {         alert(ui.item.value);     } 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -