Javascript + XenForo Options

Daniel Hood

Well-known member
Are the options set in the admin panel accessible through the XenForo javascript object? I tried
Code:
console.log(XenForo.options);
but it said undefined.
 

Daniel Hood

Well-known member
hmmm... alright. Is there a buildLink function or something I can use then? I needed options for something else but I also need to be able to build a path.
 

Chris D

XenForo developer
Staff member
Best thing to do is use data- attributes on HTML elements if appropriate.

They're used a lot in XenForo. Mostly to pass options and other data to JavaScript functions.
 

Jeremy

Well-known member
Yup, I concur with data-attributes. They are extremely useful when it comes to storing necessary information (XenForo uses them extensively).
 
Top