Is placing stuff in page text edit window bad form?

After noodling around on the web to figure out how to add additional jquery features to a WP page, a question follows.
After ‘enqueue-ing’ a js/jquery file in the theme’s function.php file and then adding some js/jquery (see example below) directly onto a page via the edit text feature in the control panel to call the extended jquery feature in the enqueue-ed file, the desired feature works on the page. Is it considered bad practice to add js/jquery scripts in their tags directly to a page?

Example:

<script>
    jQuery(document).ready(function( $ ) {
        $("#someID").somePlugin(); 
    });
</script>

2 Answers
2

Yes, it is typically considered bad form to do that. The only reason you might do that is if the script you are including will be used on the page you are editing and ONLY that page.

Leave a Comment