Adding Javascript (JS) to WordPress pages
There are times, though, when a page will need some JS that is not already provided in the Flex Theme. If a new bit of JS is required on a single page of a given site, open that page in the WordPress dashboard editor, and click on the "+" sign to add a new element. Then find the element for "Raw JS", select it, and add the JS required for this specific page in the popup window that appears. Then save the page and view it from the front end to verify that the JS is working correctly.
If JS is needed on multiple pages on a given site, access the CSS & JS Toolbox Plus in the left menu bar of the WordPress dashboard. Click on "New Code Block." When the new, blank code block appears, give it a name and add the JS that you need in it.
Once the code has been added, go to the tabbed options on the right of the code block that was just created. Select which page, post, category, etc., that this newly created JS code block needs to be added to. For example, if the JS in that specific code block needs to work on a given site's homepage, just click on the "page" tab, and then find the homepage in the list of pages that appear. Click on the check box for the homepage, and then click on the save button in the top right of that code block.
If the JS needs to be added to the entire website, or every page, or every post on the site, click on the "Aux" tab and click on either "Entire Website," "All Pages," or "All Posts." Then click on the save button in the top right of that code block.
The option to choose whether this JS appears in the hook or the footer of the pages and posts in question is also available. The hook is the default, and it can be seen by the "H" in the top row of the code block (next to the "Activate All" button). Click on the "H" to change it to an "F", which will place it in the footer.
One can also choose to have this JS added to a specific part of a page or post. To do this, take the name of your code block (whatever it was named when it was created) and place it in the following shortcode in a text box wherever you require it on the page that you need it on:
[cjtoolbox name='Your Codeblock Name']
Click on "Save" in your CSS & JS Toolbox Plus code block, then clear your site's cache by going to the Hummingbird Pro option in the left menu bar in your site's backend WordPress dashboard. Go to the "Caching" option under that, and click on "Clear Cache." Then go to a page where the JS was added to and refresh that page if the new JS function that was added cannot be seen.
Using the WordPress Editor
There is also an element in WordPress that you can use on a single page called RAW JS.

Once added to your page, you can add any JS to the page that you require. Save the code, then save the page.
NOTE: You need to make sure that the shortcode is closed for the JS to work. Also, you can add multiple JS code blocks to this element on each page if required.

Keywords: JS, javascript, code, elements, shortcode, script, CSS & JS Toolbox