0

I'm going to show you two snippets.

This works fine:

this.searchBox = new Foo.UI.SearchBox(this.input, {
    autoCompleteSearchComplete: processSearchResults
});

This doesn't work at all:

this.searchBox = new Foo.UI.SearchBox(this.input, {
    autoCompleteSearchComplete: function() {
        processSearchResults
    }
});

I need to place that processSearchResults call inside an if statement, to check if my search text input ($('.search')) has any text written inside it.

My first idea was to use this function type notation, but it's not working. It's as if the call to processSearchResults is never made at all.

Any suggestions?

0

1 Answer 1

4

That's because you do not actually call that function. This would be correct:

this.searchBox = new Foo.UI.SearchBox(this.input, {
    autoCompleteSearchComplete: function() {
        if (...) {
            processSearchResults();
        }
    }
});
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.