简体   繁体   中英

Onclick event using jQuery Autocomplete combined with a handler

I have the following textbox

<asp:TextBox ID="typeSearch" runat="server"/>

Also, I have the following javascript code within my head

    <script type="text/javascript">
        $(document).ready(function () {
            $("#<%=typeSearch.ClientID%>").autocomplete('Handler1.ashx');
        });
    </script>

In Handler1.ashx, I have the code to retrieve from a database all the related values depending on what the user writes within the TextBox "typeSearch".

What I want to achieve is when the user clicks within the textbox to view all the values. How can I achieve that combined with my handler ?

Hope this code help you!

$("#<%=typeSearch.ClientID%>").keyup(function() {

  var textValue = $(this).val();

  Search(textValue); 

});

function Search(keyword){

 //call ajax for result search here
 .....

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM