Calling XenForo javascript functions outside of instance

Daniel Hood

Well-known member
Basically I'm trying to call
Code:
XenForo.AutoComplete.results.selectResult(-1, true);
from outside of the AutoComplete class.

More specifically I need to call it for just the search bar. I tried specifying $('#QuickSearchQuery').AutoComplete.results.selectResult(-1, true); but that returns that AutoComplete is not a function. I also tried XenForo['AutoComplete']($('#QuickSearchQuery')).

Is there a way to call methods within functions that run through XenForo.register()?
 
  • Like
Reactions: Xon
Nevermind. Figured it out right after posting.. figures.

Anyone else interested, you can call:

Code:
$('#QuickSearchQuery').data('XenForo.AutoComplete'); // Or whatever the function name is.
 
  • Like
Reactions: Xon
Top Bottom