1

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

...
$( "[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...

感谢您提供更明智的解决方案中的任何快速修复或指导。

ATB

//汤姆乔德

4

1 回答 1

1

我相信在 ui 参数下的对象是一个elem, and origElem, 或类似名称的东西(可能是target, 使用 firebug 闯入并深入研究以确定);那么你可以简单地说$(ui.elem).attr('id')

于 2010-09-26T19:25:52.237 回答