我正在使用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
//汤姆乔德
答案 0 :(得分:1)
我相信在ui参数下,对象是elem
和origElem
,或类似名称(可能是target
),使用firebug进行内部挖掘并深入查找出来肯定);然后你可以简单地说$(ui.elem).attr('id')
。