开发者

Fire method to fill detailsview control, from jquery autocomplete input

开发者 https://www.devze.com 2023-02-15 10:21 出处:网络
I have an input box for searching employee info (attached to a jquery autocomplete), and a box for employee number. The employee info queries multiple values (Lastname Firstname, Title, Clocknum) and

I have an input box for searching employee info (attached to a jquery autocomplete), and a box for employee number. The employee info queries multiple values (Lastname Firstname, Title, Clocknum) and returns them all as a string via the autocomplete. This is only if they dont know the clock number. The additional box is so they can search via clocknum as well.

Is there a way, to fire a method which pop开发者_JAVA技巧ulates a data control after clicking on or tabbing on the selected jquery autocomplete value?


using the select property of your autocomplete box:

updated after ekoz's comment

$('#lastName').autocomplete
({
   source   : "FormAutoComplete.ashx",
   minChars : 3,
   width    : 325,
   mustMatch: true,
   select   : function()
   {
      //jquery allows you to save several code lines
      $('#txtClock').value(ui.item.value.substr(ui.item.value.length-5));
   }
});

a complete read of jquery autocomplete's documentation should makes clear the code above http://jqueryui.com/demos/autocomplete/

0

精彩评论

暂无评论...
验证码 换一张
取 消