• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Calling XenForo javascript functions outside of instance

Daniel Hood

Well-known member
#1
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()?
 

Daniel Hood

Well-known member
#2
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.