How to insert JavaScript into a PHP-Fusion article Updated on March 11, 2022 by InMotion Hosting Contributor 1 Minutes, 29 Seconds to Read In this article I’m going to discuss the process of adding a bit of JavaScript code into a PHP-Fusion article. This process is going to take advantage of the built-in add_to_head output handling function that is available in PHP-Fusion. There are also other output handling functions like add_to_footer and add_to_meta that allow you to perform similar actions on your content. You can see the full list of PHP-Fusion functions like this that are built-in on the PHP-Fusion 8 Development & Project site. Adding JavaScript to a PHP-Fusion article Using the steps below, I’ll walk you through the process of getting a simple JavaScript alert pop-up to function within one of your PHP-Fusion articles. Login to the PHP-Fusion admin panel. Click on Articles. I have gone ahead and filled in the Subject, Snippet, and the Article content with the following text: Subject JavaScript Hello! Snippet Make JavaScript say Hello! Article In PHP-Fusion we can add JavaScript to provide extra functionality to the site! <p style=”display:none;”> add_to_head(‘<script type=”text/javascript”>alert(“Hello world!”);</script>’); </p> You should notice that around the JavaScript code, I have added a <p style=”display: none;”> style to the paragraph tag to completely hide the JavaScipt code. Without this, the JavaScript code would still run on the page, however you’d still see the text add_to_head(”) displayed in the article. Now when we access the article that we added this JavaScript code to, we successfully see that the JavaScript code is run in our web-browser, and a pop-up message is displayed with our text. You should now know how you can get JavaScript code successfully added to one of your PHP-Fusion articles. Share this Article InMotion Hosting Contributor Content Writer InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals! More Articles by InMotion Hosting Related Articles Installing an Addon in PHP-Fusion Using the Contact Form in PHP-Fusion Security Options in PHP-Fusion Restoring a database backup in PHP-Fusion PHP-Fusion Main Site Settings Overview Modifying the Footer in PHP-Fusion Modify the sub-footer in PHP-Fusion Modify the copyright footer in PHP-Fusion Managing Site Links in PHP-Fusion Managing Panels in PHP-Fusion