I'm creating custom autocomplete with help of Ajax, jQuery and I have hard-coded one database which is created in PHP as I am getting correct output. But when I click on any text in the autocomplete box it does not get selected.
$(document).ready(function () {
$("#search_Textbox").keyup(function () {
var searchbox_Value = $("#search_Textbox").val();
$("#serach_Result").show();
if ($("#search_Textbox").val() == null || ($("#search_Textbox").val() == "")) {
$("#serach_Result").hide();
}
$.ajax({
url: "custom_database.php",
type: "GET",
data: {
text_Value: searchbox_Value
},
success: function (server_Response) {
$("#serach_Result").html(server_Response);
}
});
});
$('a').bind('click', function () {
alert("yes");
var achor_tag_text = $(this).val();
alert(achor_tag_text);
$("#search_Textbox").text(achor_tag_text);
});
});