最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - JQuery UI Autocomplete callback - Stack Overflow

programmeradmin4浏览0评论

Is it possible to define a callback function to an input which JQuery Autoplete plugin has been applied to.

I actually want to execute something on the onchange event, but, weirdly, it is triggered before the value is set. The input has a blank value when the onchage event is triggered.

Is it possible to define a callback function to an input which JQuery Autoplete plugin has been applied to.

I actually want to execute something on the onchange event, but, weirdly, it is triggered before the value is set. The input has a blank value when the onchage event is triggered.

Share Improve this question edited Jun 16, 2011 at 18:52 mu is too short 435k71 gold badges858 silver badges818 bronze badges asked Jun 16, 2011 at 18:44 Carlos BlancoCarlos Blanco 8,76217 gold badges73 silver badges103 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 7

Following js1568 answer. Here it is how.

$('selector').autoplete({
   .
   .
   .
   change: function (event, ui) { 
       //your code
   },
   close: function (event, ui) { 
       //your code
   }
})

Use the close event too, if you want your code to be triggered after the user selects a value.

http://api.jqueryui./autoplete/#event-change

Autoplete has its own events that you should use.

发布评论

评论列表(0)

  1. 暂无评论