How to get the input element triggering the jQuery autocomplete widget?
问题 I have several input fields that are enhanced with jQuery auto-complete functionality. How to get the corresponding input field when a select event is triggered? <input name="1" value=""> <input name="2" value=""> <input name="3" value=""> $('input[type=text]').autocomplete({ source: 'suggestions.php', select: function(event, ui) { // here I need the input element that have triggered the event } }); 回答1: Try using $(this) $('input[type=text]').autocomplete({ source: 'suggestions.php', select: