0

I have an auto-complete input, works great ..

When I fill the content through the JS code, it does not make it in the auto-complete, and I need him to do so.

I tried to put the focus on the input, and run keypress event, it does not work ... What can I do?

Code (which fill in the input):

function FillInput() {
        document.getElementById("MyInput").value ='xxx';
        $('.SearchCities').keypress();
        $('.SearchCities').focus();

    }

1 Answer 1

2

Try triggering the keyup event instead, as this is what autocomplete listens for. There probably aren't any handlers bound for keypress.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.