简体   繁体   English

jQuery:使用通配符选择器时如何返回呼叫者ID

[英]jquery: howto return caller-id when using wildcard selectors

i'm using jquery to invoke JSON-requests and they're triggered form a bunch of autocomplete-fields. 我正在使用jquery来调用JSON请求,并且它们是由一堆自动完成字段触发的。 I use wildcard-selector and now need to find out which ac-field that fired the event. 我使用通配符选择器,现在需要找出触发该事件的交流场。

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

Thankful for any quickfix or guidance in wiser solution. 感谢您提供任何更快速的解决方案或更明智的解决方案指南。

ATB 空中交通局

//tom joad // tom joad

I believe under the ui argument object is an elem , and origElem , or something of a similar name (might be target , break inside using firebug and drill into it to find out for sure); 我相信在ui参数对象下是elemorigElem或类似名称的东西(可能是target ,使用firebug闯入并深入查明以便确定); then you can simply say $(ui.elem).attr('id') . 那么您可以简单地说$(ui.elem).attr('id')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM