Call function within autocomplete jQuery plugin [closed]

百般思念 提交于 2019-12-07 08:47:26

You can add an event handler like this

$('#txtDemo').on('change', function(){
 var value = $(this).val();
 Demo (value); //pass the value as paramter
});

//Handle it here
function Demo (value) {
 //code for getting value from code behind in the form of array
}

From your comments: Possible using select

select( event, ui )Type: autocompleteselect

Triggered when an item is selected from the menu. The default action is to replace the text field's value with the value of the selected item.

$("#txtDemo").autocomplete({   
   source: availableTags,
   select: function( event, ui ) {
            demo(ui.item.value);          
      }

});

Here is sample working fiddle

Hope you can understand.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!