Hello! I'm trying to do a search on the Yandex map without clicking the "search" button, i.e. when you enter a search query must be made. The behavior that I want to implement is presented on the Yandex maps page: https://yandex.ru/maps

I did it, but there was a problem: incompletely written addresses are automatically corrected to the correct ones in the search field, which is rather inconvenient if you type from a mobile phone. To make it clear what I am talking about, I created an example in the sandbox: http://jsbin.com/biqihiq Try entering any address (for example, Komsomolsky Prospect). Fully dial it will not work, because the address will be automatically corrected to "correct". I want the text in the search field not to be corrected. How to achieve this behavior? Or is it better to implement a live search in a different way? How?

The commented out piece of code below is my solution to the problem: just when downloading the results, manually change the “corrected” address to the one that was entered. It works, but, in my opinion, this is too a crutch decision. It also has a question: how to get a link to the search input element? As it seems to me, accessing it via the css-selector is not the most correct decision. How can I correctly change the entered value in the search field? Thank!

    1 answer 1

    On Yandex.Maps this is not a "live search", but search suggestions - suggest . It's just that there is a custom layout of the tips. The search is the same as in the API - by clicking the "Find" button.

    To do real search queries with partial input is a bad practice, firstly, the free use limit will end very quickly, and secondly, the search result will always be “corrected” and formatted differently.

    By the way, by default, search prompts are included in the standard API search box, that is, you don’t need to do anything specifically.

    Read more in the documentation.

    An example of search hints in the external input field