Suppose there is a script that is initialized by referring to the selector.
$('.autocomplete').autocomplete({ serviceUrl: function() { return ('//autocomplete.travelpayouts.com/jravia?locale=ru&with_countries=false&q=' + $(this).val()); }); It has a serviceUrl setting in which the function returns a link. But in order to generate a link, you need to find the value .autocomplete , however, $(this) in the body of the serviceUrl points to the serviceUrl function, and not to the selector itself. So, how can you refer to .autocomplete from the body of the serviceUrl function?
$(this)in the body ofserviceUrlpoints to the functionserviceUrl" - you are mistaken, addconsole.log(this);beforereturn ...;- Igor