Loading

Can I use JavaScript and jQuery in my NationBuilder site?

Official response from Matthew Pancione

Yes. You can upload your own scripts under Websites > Theme > Files.

NationBuilder comes with the latest version of jQuery, and Tipsy installed and available on any page.

Other custom scripts are only loaded if the particular page being opened requires it so we can reduce load times, but they are not scripts that you would be using to customize a theme.

How would you tag this suggestion?
Do you like this suggestion?

Showing 8 reactions


Jake Martin commented 2013-03-18 22:34:14 -0700 · Flag
Hehe :) Im a creature of habit! Coming from Wordpress, I always use absolute pathing, so a bit to wrap my mind around.
Adriel Hampton tagged this with Advanced 2013-03-18 20:54:13 -0700
Adriel Hampton commented 2013-03-18 20:53:58 -0700 · Flag
Jinx ;)
Adriel Hampton commented 2013-03-18 20:53:41 -0700 · Flag
Jake, refer to the custom theme documentation for more information on how to upload and reference your .js files – http://nationbuilder.com/theme_documentation
Jake Martin commented 2013-03-18 20:53:35 -0700 · Flag
Ugh, I should’ve searched more. So to use external JS, as Matthew mentioned, upload them. Then just reference the file relatively; aka not an absolute url (no http://www.yourdomain.com). NationBuilder will figure out the pathing for you.
Jake Martin commented 2013-03-18 20:45:00 -0700 · Flag
In fact, you cannot use external JavaScript files, unless you host them on a CDN. There is no way in the current GUI to get the filepath of the JS file.
Jake Martin commented 2013-03-18 20:39:30 -0700 · Flag
What is the path to the JavaScript though once it has been uploaded?
Matthew Pancione responded 2013-03-18 16:24:16 -0700