jquery:使用通配符选择器时如何返回caller-id

时间:2010-09-26 19:06:30

标签: json jquery jquery-selectors jquery-callback

我正在使用jquery来调用JSON请求,并且它们是从一堆自动完成字段中触发的。我使用通配符选择器,现在需要找出触发事件的ac-field。

...
$( "[id*='_lookupCmb']" ).autocomplete({
  source: function( request, response ) {
    $.ajax({
      ...
      ...
      select: function( event, ui ) {
        //here I want to get the name of the id calling the request...

感谢更明智的解决方案中的任何quickfix或指导。

ATB

//汤姆乔德

1 个答案:

答案 0 :(得分:1)

我相信在ui参数下,对象是elemorigElem,或类似名称(可能是target),使用firebug进行内部挖掘并深入查找出来肯定);然后你可以简单地说$(ui.elem).attr('id')