Это this
(это необработанный элемент, а не оболочка), как и в большинстве событий jQuery Это может быть задокументировано лучше. :-) Так в вашем случае:
$(".field").autocomplete({
source:"search.php",
select:function(event,ui){
// Here, `this` is the raw DOM element of the field
$(this).doStuff();
}
});
Пример ( живая копия ):
HTML:
<p>Type a <kbd>t</kbd> then pick a choice. The field will turn green briefly.</p>
<input class="ac" type="text">
<input class="ac" type="text">
<input class="ac" type="text">
JavaScript:
jQuery(function($) {
$(".ac").autocomplete({
source: ["two", "three", "thirty"],
select: function(event, ui) {
var $this = $(this);
$this.css("color", "green");
setTimeout(function() {
$this.css("color", "");
}, 500);
}
});
});